diff --git a/F-Droid/src/org/fdroid/fdroid/installer/Installer.java b/F-Droid/src/org/fdroid/fdroid/installer/Installer.java index b43b5e21b..97517e9f9 100644 --- a/F-Droid/src/org/fdroid/fdroid/installer/Installer.java +++ b/F-Droid/src/org/fdroid/fdroid/installer/Installer.java @@ -160,7 +160,7 @@ abstract public class Installer { try { activity = (Activity) mContext; } catch (ClassCastException e) { - Log.d(TAG, "F-Droid Privileged can only be updated using an activity!"); + Utils.debugLog(TAG, "F-Droid Privileged can only be updated using an activity!"); return; } diff --git a/F-Droid/src/org/fdroid/fdroid/localrepo/peers/BluetoothFinder.java b/F-Droid/src/org/fdroid/fdroid/localrepo/peers/BluetoothFinder.java index 044c36441..6dc207f7d 100644 --- a/F-Droid/src/org/fdroid/fdroid/localrepo/peers/BluetoothFinder.java +++ b/F-Droid/src/org/fdroid/fdroid/localrepo/peers/BluetoothFinder.java @@ -9,6 +9,8 @@ import android.content.Intent; import android.content.IntentFilter; import android.util.Log; +import org.fdroid.fdroid.Utils; + public class BluetoothFinder extends PeerFinder { private static final String TAG = "BluetoothFinder"; @@ -53,7 +55,7 @@ public class BluetoothFinder extends PeerFinder { @Override public void onReceive(Context context, Intent intent) { if (isScanning) { - Log.d(TAG, "Scan complete, but we haven't been asked to stop scanning yet, so will restart scan."); + Utils.debugLog(TAG, "Scan complete, but we haven't been asked to stop scanning yet, so will restart scan."); startDiscovery(); } } @@ -72,7 +74,7 @@ public class BluetoothFinder extends PeerFinder { // TODO: Can we reset the discovering timeout, so that it doesn't, e.g. time out in 3 // seconds because we had already almost completed the previous scan? We could // cancelDiscovery(), but then it will probably prompt the user again. - Log.d(TAG, "Requested bluetooth scan when already scanning, so will ignore request."); + Utils.debugLog(TAG, "Requested bluetooth scan when already scanning, so will ignore request."); return; } @@ -85,7 +87,7 @@ public class BluetoothFinder extends PeerFinder { @Override public void cancel() { if (adapter != null) { - Log.d(TAG, "Stopping bluetooth discovery."); + Utils.debugLog(TAG, "Stopping bluetooth discovery."); adapter.cancelDiscovery(); } diff --git a/F-Droid/src/org/fdroid/fdroid/localrepo/peers/BonjourFinder.java b/F-Droid/src/org/fdroid/fdroid/localrepo/peers/BonjourFinder.java index 69a507777..98aee84a5 100644 --- a/F-Droid/src/org/fdroid/fdroid/localrepo/peers/BonjourFinder.java +++ b/F-Droid/src/org/fdroid/fdroid/localrepo/peers/BonjourFinder.java @@ -5,8 +5,8 @@ import android.net.wifi.WifiManager; import android.os.AsyncTask; import android.util.Log; -import org.fdroid.fdroid.BuildConfig; import org.fdroid.fdroid.FDroidApp; +import org.fdroid.fdroid.Utils; import java.io.IOException; import java.net.InetAddress; @@ -34,7 +34,7 @@ public class BonjourFinder extends PeerFinder implements ServiceLis @Override public void scan() { - Log.d(TAG, "Requested Bonjour (mDNS) scan for peers."); + Utils.debugLog(TAG, "Requested Bonjour (mDNS) scan for peers."); if (wifiManager == null) { wifiManager = (WifiManager) context.getSystemService(Context.WIFI_SERVICE); @@ -43,7 +43,7 @@ public class BonjourFinder extends PeerFinder implements ServiceLis } if (isScanning) { - Log.d(TAG, "Requested Bonjour scan, but already scanning. But we will still try to explicitly scan for services."); + Utils.debugLog(TAG, "Requested Bonjour scan, but already scanning. But we will still try to explicitly scan for services."); // listServices(); return; } @@ -55,7 +55,7 @@ public class BonjourFinder extends PeerFinder implements ServiceLis @Override protected Void doInBackground(Void... params) { try { - Log.d(TAG, "Searching for Bonjour (mDNS) clients..."); + Utils.debugLog(TAG, "Searching for Bonjour (mDNS) clients..."); jmdns = JmDNS.create(InetAddress.getByName(FDroidApp.ipAddressString)); } catch (IOException e) { Log.e(TAG, "", e); @@ -67,7 +67,7 @@ public class BonjourFinder extends PeerFinder implements ServiceLis protected void onPostExecute(Void result) { // TODO: This is not threadsafe - cancelling the discovery will make jmdns null, but it could happen after this check and before call to addServiceListener(). if (jmdns != null) { - Log.d(TAG, "Adding mDNS service listeners for " + HTTP_SERVICE_TYPE + " and " + HTTPS_SERVICE_TYPE); + Utils.debugLog(TAG, "Adding mDNS service listeners for " + HTTP_SERVICE_TYPE + " and " + HTTPS_SERVICE_TYPE); jmdns.addServiceListener(HTTP_SERVICE_TYPE, BonjourFinder.this); jmdns.addServiceListener(HTTPS_SERVICE_TYPE, BonjourFinder.this); listServices(); @@ -87,7 +87,7 @@ public class BonjourFinder extends PeerFinder implements ServiceLis @Override protected Void doInBackground(Void... params) { - Log.d(TAG, "Explicitly querying for services, in addition to waiting for notifications."); + Utils.debugLog(TAG, "Explicitly querying for services, in addition to waiting for notifications."); addFDroidServices(mdns.list(HTTP_SERVICE_TYPE)); addFDroidServices(mdns.list(HTTPS_SERVICE_TYPE)); return null; @@ -145,17 +145,13 @@ public class BonjourFinder extends PeerFinder implements ServiceLis final boolean isFDroid = type != null && type.startsWith("fdroidrepo"); final boolean isSelf = FDroidApp.repo != null && fingerprint != null && fingerprint.equalsIgnoreCase(FDroidApp.repo.fingerprint); if (isFDroid && !isSelf) { - if (BuildConfig.DEBUG) { - Log.d(TAG, "Found F-Droid swap Bonjour service:\n" + serviceInfo); - } + Utils.debugLog(TAG, "Found F-Droid swap Bonjour service:\n" + serviceInfo); foundPeer(new BonjourPeer(serviceInfo)); } else { - if (BuildConfig.DEBUG) { - if (isSelf) { - Log.d(TAG, "Ignoring Bonjour service because it belongs to this device:\n" + serviceInfo); - } else { - Log.d(TAG, "Ignoring Bonjour service because it doesn't look like an F-Droid swap repo:\n" + serviceInfo); - } + if (isSelf) { + Utils.debugLog(TAG, "Ignoring Bonjour service because it belongs to this device:\n" + serviceInfo); + } else { + Utils.debugLog(TAG, "Ignoring Bonjour service because it doesn't look like an F-Droid swap repo:\n" + serviceInfo); } } } diff --git a/F-Droid/src/org/fdroid/fdroid/localrepo/type/BluetoothSwap.java b/F-Droid/src/org/fdroid/fdroid/localrepo/type/BluetoothSwap.java index 7894ebeb9..cff993e3d 100644 --- a/F-Droid/src/org/fdroid/fdroid/localrepo/type/BluetoothSwap.java +++ b/F-Droid/src/org/fdroid/fdroid/localrepo/type/BluetoothSwap.java @@ -9,6 +9,7 @@ import android.support.annotation.NonNull; import android.support.annotation.Nullable; import android.util.Log; +import org.fdroid.fdroid.Utils; import org.fdroid.fdroid.localrepo.SwapService; import org.fdroid.fdroid.net.bluetooth.BluetoothServer; @@ -87,7 +88,7 @@ public class BluetoothSwap extends SwapType { /* if (server != null) { - Log.d(TAG, "Attempting to start Bluetooth swap, but it appears to be running already. Will cancel it so it can be restarted."); + Utils.debugLog(TAG, "Attempting to start Bluetooth swap, but it appears to be running already. Will cancel it so it can be restarted."); server.close(); server = null; }*/ @@ -101,7 +102,7 @@ public class BluetoothSwap extends SwapType { deviceBluetoothName = adapter.getName(); /* - Log.d(TAG, "Prefixing Bluetooth adapter name with " + BLUETOOTH_NAME_TAG + " to make it identifiable as a swap device."); + Utils.debugLog(TAG, "Prefixing Bluetooth adapter name with " + BLUETOOTH_NAME_TAG + " to make it identifiable as a swap device."); if (!deviceBluetoothName.startsWith(BLUETOOTH_NAME_TAG)) adapter.setName(BLUETOOTH_NAME_TAG + deviceBluetoothName); @@ -111,9 +112,9 @@ public class BluetoothSwap extends SwapType { }*/ if (!adapter.isEnabled()) { - Log.d(TAG, "Bluetooth adapter is disabled, attempting to enable."); + Utils.debugLog(TAG, "Bluetooth adapter is disabled, attempting to enable."); if (!adapter.enable()) { - Log.d(TAG, "Could not enable Bluetooth adapter, so bailing out of Bluetooth swap."); + Utils.debugLog(TAG, "Could not enable Bluetooth adapter, so bailing out of Bluetooth swap."); setConnected(false); return; } @@ -153,7 +154,7 @@ public class BluetoothSwap extends SwapType { } protected void onStopped() { - Log.d(TAG, "Resetting bluetooth device name to " + deviceBluetoothName + " after swapping."); + Utils.debugLog(TAG, "Resetting bluetooth device name to " + deviceBluetoothName + " after swapping."); adapter.setName(deviceBluetoothName); } diff --git a/F-Droid/src/org/fdroid/fdroid/localrepo/type/BonjourBroadcast.java b/F-Droid/src/org/fdroid/fdroid/localrepo/type/BonjourBroadcast.java index 3d6743858..63181ce26 100644 --- a/F-Droid/src/org/fdroid/fdroid/localrepo/type/BonjourBroadcast.java +++ b/F-Droid/src/org/fdroid/fdroid/localrepo/type/BonjourBroadcast.java @@ -32,7 +32,7 @@ public class BonjourBroadcast extends SwapType { @Override public void start() { - Log.d(TAG, "Preparing to start Bonjour service."); + Utils.debugLog(TAG, "Preparing to start Bonjour service."); sendBroadcast(SwapService.EXTRA_STARTING); /* @@ -56,12 +56,12 @@ public class BonjourBroadcast extends SwapType { type = "_http._tcp.local."; } try { - Log.d(TAG, "Starting bonjour service..."); + Utils.debugLog(TAG, "Starting bonjour service..."); pairService = ServiceInfo.create(type, repoName, FDroidApp.port, 0, 0, values); jmdns = JmDNS.create(InetAddress.getByName(FDroidApp.ipAddressString)); jmdns.registerService(pairService); setConnected(true); - Log.d(TAG, "... Bounjour service started."); + Utils.debugLog(TAG, "... Bounjour service started."); } catch (IOException e) { Log.e(TAG, "Error while registering jmdns service", e); setConnected(false); @@ -70,7 +70,7 @@ public class BonjourBroadcast extends SwapType { @Override public void stop() { - Log.d(TAG, "Unregistering MDNS service..."); + Utils.debugLog(TAG, "Unregistering MDNS service..."); clearCurrentMDNSService(); setConnected(false); } diff --git a/F-Droid/src/org/fdroid/fdroid/net/BluetoothDownloader.java b/F-Droid/src/org/fdroid/fdroid/net/BluetoothDownloader.java index b5be71fe4..1ca007557 100644 --- a/F-Droid/src/org/fdroid/fdroid/net/BluetoothDownloader.java +++ b/F-Droid/src/org/fdroid/fdroid/net/BluetoothDownloader.java @@ -4,6 +4,7 @@ import android.content.Context; import android.util.Log; import org.apache.commons.io.input.BoundedInputStream; +import org.fdroid.fdroid.Utils; import org.fdroid.fdroid.net.bluetooth.BluetoothClient; import org.fdroid.fdroid.net.bluetooth.BluetoothConnection; import org.fdroid.fdroid.net.bluetooth.FileDetails; @@ -58,7 +59,7 @@ public class BluetoothDownloader extends Downloader { */ public FileDetails getFileDetails() { if (fileDetails == null) { - Log.d(TAG, "Going to Bluetooth \"server\" to get file details."); + Utils.debugLog(TAG, "Going to Bluetooth \"server\" to get file details."); try { fileDetails = Request.createHEAD(sourceUrl.getPath(), connection).send().toFileDetails(); } catch (IOException e) { diff --git a/F-Droid/src/org/fdroid/fdroid/net/WifiStateChangeService.java b/F-Droid/src/org/fdroid/fdroid/net/WifiStateChangeService.java index 5befdbaf2..0b4ca87e7 100644 --- a/F-Droid/src/org/fdroid/fdroid/net/WifiStateChangeService.java +++ b/F-Droid/src/org/fdroid/fdroid/net/WifiStateChangeService.java @@ -17,7 +17,6 @@ import android.text.TextUtils; import android.util.Log; import org.apache.commons.net.util.SubnetUtils; -import org.fdroid.fdroid.BuildConfig; import org.fdroid.fdroid.FDroidApp; import org.fdroid.fdroid.Preferences; import org.fdroid.fdroid.Utils; @@ -45,7 +44,7 @@ public class WifiStateChangeService extends Service { @Override public int onStartCommand(Intent intent, int flags, int startId) { - Log.d(TAG, "WiFi change service started, clearing info about wifi state until we have figured it out again."); + Utils.debugLog(TAG, "WiFi change service started, clearing info about wifi state until we have figured it out again."); FDroidApp.initWifiSettings(); NetworkInfo ni = intent.getParcelableExtra(WifiManager.EXTRA_NETWORK_INFO); wifiManager = (WifiManager) getSystemService(WIFI_SERVICE); @@ -74,7 +73,7 @@ public class WifiStateChangeService extends Service { @Override protected Void doInBackground(Void... params) { try { - Log.d(TAG, "Checking wifi state (in background thread)."); + Utils.debugLog(TAG, "Checking wifi state (in background thread)."); WifiInfo wifiInfo = null; wifiState = wifiManager.getWifiState(); @@ -100,9 +99,7 @@ public class WifiStateChangeService extends Service { if (FDroidApp.ipAddressString == null) { Thread.sleep(1000); - if (BuildConfig.DEBUG) { - Utils.debugLog(TAG, "waiting for an IP address..."); - } + Utils.debugLog(TAG, "waiting for an IP address..."); } } if (isCancelled()) // can be canceled by a change via WifiStateChangeReceiver @@ -110,7 +107,7 @@ public class WifiStateChangeService extends Service { if (wifiInfo != null) { String ssid = wifiInfo.getSSID(); - Log.d(TAG, "Have wifi info, connected to " + ssid); + Utils.debugLog(TAG, "Have wifi info, connected to " + ssid); if (ssid != null) { FDroidApp.ssid = ssid.replaceAll("^\"(.*)\"$", "$1"); } diff --git a/F-Droid/src/org/fdroid/fdroid/net/bluetooth/BluetoothConnection.java b/F-Droid/src/org/fdroid/fdroid/net/bluetooth/BluetoothConnection.java index 5e6e1346e..1a24a7586 100644 --- a/F-Droid/src/org/fdroid/fdroid/net/bluetooth/BluetoothConnection.java +++ b/F-Droid/src/org/fdroid/fdroid/net/bluetooth/BluetoothConnection.java @@ -43,7 +43,7 @@ public class BluetoothConnection { input = new BufferedInputStream(socket.getInputStream()); output = new BufferedOutputStream(socket.getOutputStream()); - Log.d(TAG, "Opened connection to Bluetooth device"); + Utils.debugLog(TAG, "Opened connection to Bluetooth device"); } public void closeQuietly() { diff --git a/F-Droid/src/org/fdroid/fdroid/net/bluetooth/BluetoothServer.java b/F-Droid/src/org/fdroid/fdroid/net/bluetooth/BluetoothServer.java index c5bb6dda4..c8eb786a4 100644 --- a/F-Droid/src/org/fdroid/fdroid/net/bluetooth/BluetoothServer.java +++ b/F-Droid/src/org/fdroid/fdroid/net/bluetooth/BluetoothServer.java @@ -76,7 +76,7 @@ public class BluetoothServer extends Thread { while (true) { if (isInterrupted()) { - Log.d(TAG, "Server stopped so will terminate loop looking for client connections."); + Utils.debugLog(TAG, "Server stopped so will terminate loop looking for client connections."); break; } @@ -84,7 +84,7 @@ public class BluetoothServer extends Thread { BluetoothSocket clientSocket = serverSocket.accept(); if (clientSocket != null) { if (isInterrupted()) { - Log.d(TAG, "Server stopped after socket accepted from client, but before initiating connection."); + Utils.debugLog(TAG, "Server stopped after socket accepted from client, but before initiating connection."); break; } ClientConnection client = new ClientConnection(clientSocket, webRoot); @@ -111,7 +111,7 @@ public class BluetoothServer extends Thread { @Override public void run() { - Log.d(TAG, "Listening for incoming Bluetooth requests from client"); + Utils.debugLog(TAG, "Listening for incoming Bluetooth requests from client"); BluetoothConnection connection; try { @@ -125,7 +125,7 @@ public class BluetoothServer extends Thread { while (true) { try { - Log.d(TAG, "Listening for new Bluetooth request from client."); + Utils.debugLog(TAG, "Listening for new Bluetooth request from client."); Request incomingRequest = Request.listenForRequest(connection); handleRequest(incomingRequest).send(connection); } catch (IOException e) { @@ -143,7 +143,7 @@ public class BluetoothServer extends Thread { private Response handleRequest(Request request) throws IOException { - Log.d(TAG, "Received Bluetooth request from client, will process it now."); + Utils.debugLog(TAG, "Received Bluetooth request from client, will process it now."); Response.Builder builder = null; diff --git a/F-Droid/src/org/fdroid/fdroid/net/bluetooth/httpish/Request.java b/F-Droid/src/org/fdroid/fdroid/net/bluetooth/httpish/Request.java index 40e097ebe..4b3672831 100644 --- a/F-Droid/src/org/fdroid/fdroid/net/bluetooth/httpish/Request.java +++ b/F-Droid/src/org/fdroid/fdroid/net/bluetooth/httpish/Request.java @@ -2,6 +2,7 @@ package org.fdroid.fdroid.net.bluetooth.httpish; import android.util.Log; +import org.fdroid.fdroid.Utils; import org.fdroid.fdroid.net.bluetooth.BluetoothConnection; import java.io.ByteArrayOutputStream; @@ -54,7 +55,7 @@ public class Request { public Response send() throws IOException { - Log.d(TAG, "Sending request to server (" + path + ")"); + Utils.debugLog(TAG, "Sending request to server (" + path + ")"); output.write(method); output.write(' '); @@ -64,21 +65,21 @@ public class Request { output.flush(); - Log.d(TAG, "Finished sending request, now attempting to read response status code..."); + Utils.debugLog(TAG, "Finished sending request, now attempting to read response status code..."); int responseCode = readResponseCode(); - Log.d(TAG, "Read response code " + responseCode + " from server, now reading headers..."); + Utils.debugLog(TAG, "Read response code " + responseCode + " from server, now reading headers..."); Map headers = readHeaders(); - Log.d(TAG, "Read " + headers.size() + " headers"); + Utils.debugLog(TAG, "Read " + headers.size() + " headers"); if (method.equals(Methods.HEAD)) { - Log.d(TAG, "Request was a " + Methods.HEAD + " request, not including anything other than headers and status..."); + Utils.debugLog(TAG, "Request was a " + Methods.HEAD + " request, not including anything other than headers and status..."); return new Response(responseCode, headers); } else { - Log.d(TAG, "Request was a " + Methods.GET + " request, so including content stream in response..."); + Utils.debugLog(TAG, "Request was a " + Methods.GET + " request, so including content stream in response..."); return new Response(responseCode, headers, connection.getInputStream()); } diff --git a/F-Droid/src/org/fdroid/fdroid/net/bluetooth/httpish/Response.java b/F-Droid/src/org/fdroid/fdroid/net/bluetooth/httpish/Response.java index 1ba8cf9a7..e19c1d07a 100644 --- a/F-Droid/src/org/fdroid/fdroid/net/bluetooth/httpish/Response.java +++ b/F-Droid/src/org/fdroid/fdroid/net/bluetooth/httpish/Response.java @@ -107,7 +107,7 @@ public class Response { public void send(BluetoothConnection connection) throws IOException { - Log.d(TAG, "Sending Bluetooth HTTP-ish response..."); + Utils.debugLog(TAG, "Sending Bluetooth HTTP-ish response..."); Writer output = new OutputStreamWriter(connection.getOutputStream()); output.write("HTTP(ish)/0.1 200 OK\n"); diff --git a/F-Droid/src/org/fdroid/fdroid/views/swap/SwapAppsView.java b/F-Droid/src/org/fdroid/fdroid/views/swap/SwapAppsView.java index bb7161be2..0e777c1ec 100644 --- a/F-Droid/src/org/fdroid/fdroid/views/swap/SwapAppsView.java +++ b/F-Droid/src/org/fdroid/fdroid/views/swap/SwapAppsView.java @@ -126,11 +126,11 @@ public class SwapAppsView extends ListView implements private void pollForUpdates() { if (adapter.getCount() > 1 || (adapter.getCount() == 1 && !new App((Cursor)adapter.getItem(0)).id.equals("org.fdroid.fdroid"))) { - Log.d(TAG, "Not polling for new apps from swap repo, because we already have more than one."); + Utils.debugLog(TAG, "Not polling for new apps from swap repo, because we already have more than one."); return; } - Log.d(TAG, "Polling swap repo to see if it has any updates."); + Utils.debugLog(TAG, "Polling swap repo to see if it has any updates."); getActivity().getService().refreshSwap(); if (pollForUpdatesReceiver != null) { pollForUpdatesReceiver = new BroadcastReceiver() { @@ -139,7 +139,7 @@ public class SwapAppsView extends ListView implements int statusCode = intent.getIntExtra(UpdateService.EXTRA_STATUS_CODE, -1); switch (statusCode) { case UpdateService.STATUS_COMPLETE_WITH_CHANGES: - Log.d(TAG, "Swap repo has updates, notifying the list adapter."); + Utils.debugLog(TAG, "Swap repo has updates, notifying the list adapter."); getActivity().runOnUiThread(new Runnable() { @Override public void run() { @@ -166,7 +166,7 @@ public class SwapAppsView extends ListView implements } private void schedulePollForUpdates() { - Log.d(TAG, "Scheduling poll for updated swap repo in 5 seconds."); + Utils.debugLog(TAG, "Scheduling poll for updated swap repo in 5 seconds."); new Timer().schedule(new TimerTask() { @Override public void run() { diff --git a/F-Droid/src/org/fdroid/fdroid/views/swap/SwapWorkflowActivity.java b/F-Droid/src/org/fdroid/fdroid/views/swap/SwapWorkflowActivity.java index 4e64a8a31..c26b9933e 100644 --- a/F-Droid/src/org/fdroid/fdroid/views/swap/SwapWorkflowActivity.java +++ b/F-Droid/src/org/fdroid/fdroid/views/swap/SwapWorkflowActivity.java @@ -123,7 +123,7 @@ public class SwapWorkflowActivity extends AppCompatActivity { private final ServiceConnection serviceConnection = new ServiceConnection() { @Override public void onServiceConnected(ComponentName className, IBinder binder) { - Log.d(TAG, "Swap service connected. Will hold onto it so we can talk to it regularly."); + Utils.debugLog(TAG, "Swap service connected. Will hold onto it so we can talk to it regularly."); service = ((SwapService.Binder)binder).getService(); showRelevantView(); } @@ -131,7 +131,7 @@ public class SwapWorkflowActivity extends AppCompatActivity { // TODO: What causes this? Do we need to stop swapping explicitly when this is invoked? @Override public void onServiceDisconnected(ComponentName className) { - Log.d(TAG, "Swap service disconnected"); + Utils.debugLog(TAG, "Swap service disconnected"); service = null; // TODO: What to do about the UI in this instance? } @@ -262,7 +262,7 @@ public class SwapWorkflowActivity extends AppCompatActivity { Log.e(TAG, "Could not enable WiFi AP."); // TODO: Feedback to user? } else { - Log.d(TAG, "WiFi AP enabled."); + Utils.debugLog(TAG, "WiFi AP enabled."); // TODO: Seems to be broken some times... } } @@ -456,7 +456,7 @@ public class SwapWorkflowActivity extends AppCompatActivity { // this, but this should never take precedence over the other. // TODO: Also don't allow this to run multiple times (e.g. if a user keeps navigating back // to the main screen. - Log.d(TAG, "Preparing initial repo with only F-Droid, until we have allowed the user to configure their own repo."); + Utils.debugLog(TAG, "Preparing initial repo with only F-Droid, until we have allowed the user to configure their own repo."); new PrepareInitialSwapRepo().execute(); } @@ -569,20 +569,20 @@ public class SwapWorkflowActivity extends AppCompatActivity { } else if (requestCode == REQUEST_BLUETOOTH_ENABLE_FOR_SWAP) { if (resultCode == RESULT_OK) { - Log.d(TAG, "User enabled Bluetooth, will make sure we are discoverable."); + Utils.debugLog(TAG, "User enabled Bluetooth, will make sure we are discoverable."); ensureBluetoothDiscoverableThenStart(); } else { // Didn't enable bluetooth - Log.d(TAG, "User chose not to enable Bluetooth, so doing nothing (i.e. sticking with wifi)."); + Utils.debugLog(TAG, "User chose not to enable Bluetooth, so doing nothing (i.e. sticking with wifi)."); } } else if (requestCode == REQUEST_BLUETOOTH_DISCOVERABLE) { if (resultCode != RESULT_CANCELED) { - Log.d(TAG, "User made Bluetooth discoverable, will proceed to start bluetooth server."); + Utils.debugLog(TAG, "User made Bluetooth discoverable, will proceed to start bluetooth server."); getState().getBluetoothSwap().startInBackground(); } else { - Log.d(TAG, "User chose not to make Bluetooth discoverable, so doing nothing (i.e. sticking with wifi)."); + Utils.debugLog(TAG, "User chose not to make Bluetooth discoverable, so doing nothing (i.e. sticking with wifi)."); } } else if (requestCode == REQUEST_BLUETOOTH_ENABLE_FOR_SEND) { @@ -603,28 +603,28 @@ public class SwapWorkflowActivity extends AppCompatActivity { */ public void startBluetoothSwap() { - Log.d(TAG, "Initiating Bluetooth swap, will ensure the Bluetooth devices is enabled and discoverable before starting server."); + Utils.debugLog(TAG, "Initiating Bluetooth swap, will ensure the Bluetooth devices is enabled and discoverable before starting server."); BluetoothAdapter adapter = BluetoothAdapter.getDefaultAdapter(); if (adapter != null) if (adapter.isEnabled()) { - Log.d(TAG, "Bluetooth enabled, will check if device is discoverable with device."); + Utils.debugLog(TAG, "Bluetooth enabled, will check if device is discoverable with device."); ensureBluetoothDiscoverableThenStart(); } else { - Log.d(TAG, "Bluetooth disabled, asking user to enable it."); + Utils.debugLog(TAG, "Bluetooth disabled, asking user to enable it."); Intent enableBtIntent = new Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE); startActivityForResult(enableBtIntent, REQUEST_BLUETOOTH_ENABLE_FOR_SWAP); } } private void ensureBluetoothDiscoverableThenStart() { - Log.d(TAG, "Ensuring Bluetooth is in discoverable mode."); + Utils.debugLog(TAG, "Ensuring Bluetooth is in discoverable mode."); if (BluetoothAdapter.getDefaultAdapter().getScanMode() != BluetoothAdapter.SCAN_MODE_CONNECTABLE_DISCOVERABLE) { // TODO: Listen for BluetoothAdapter.ACTION_SCAN_MODE_CHANGED and respond if discovery // is cancelled prematurely. - Log.d(TAG, "Not currently in discoverable mode, so prompting user to enable."); + Utils.debugLog(TAG, "Not currently in discoverable mode, so prompting user to enable."); Intent intent = new Intent(BluetoothAdapter.ACTION_REQUEST_DISCOVERABLE); intent.putExtra(BluetoothAdapter.EXTRA_DISCOVERABLE_DURATION, BluetoothFinder.DISCOVERABLE_TIMEOUT); // 3600 is new maximum! TODO: What about when this expires? What if user manually disables discovery? startActivityForResult(intent, REQUEST_BLUETOOTH_DISCOVERABLE); @@ -678,7 +678,7 @@ public class SwapWorkflowActivity extends AppCompatActivity { Intent intent = new Intent(ACTION); intent.putExtra(EXTRA_TYPE, type); if (message != null) { - Log.d(TAG, "Preparing swap: " + message); + Utils.debugLog(TAG, "Preparing swap: " + message); intent.putExtra(EXTRA_MESSAGE, message); } LocalBroadcastManager.getInstance(SwapWorkflowActivity.this).sendBroadcast(intent); @@ -771,7 +771,7 @@ public class SwapWorkflowActivity extends AppCompatActivity { } Date now = new Date(); - Log.d("Swap Status", now.getHours() + ":" + now.getMinutes() + ":" + now.getSeconds() + " " + message); + Utils.debugLog("Swap Status", now.getHours() + ":" + now.getMinutes() + ":" + now.getSeconds() + " " + message); new Timer().schedule(new TimerTask() { @Override