1
0
mirror of https://github.com/etesync/android synced 2024-11-22 07:58:09 +00:00

Debugging improvements

* force debugging options for resource detection (because there's no way to turn them on until there's an account)
* provide "report issue" button in debug settings
* provide CONTRIBUTING.md, including instructions on how to report issues
* increase socket timeout from 20 to 45 seconds (hopefully fixes #237)
* previous commit: increase total simultaneous connections to 3 (2 per host)
This commit is contained in:
rfc2822 2014-05-09 15:20:45 +02:00
parent 3e4efe8b82
commit 13cfe3ce98
14 changed files with 112 additions and 22 deletions

56
CONTRIBUTING.md Normal file
View File

@ -0,0 +1,56 @@
DAVdroid is free and open-source software, licensed under the [GPLv3 License](COPYING).
If you like our project, please contribute to it.
# How to contribute
## Reporting issues
An issue might be a bug, an enhancement request or something in between. If you think you
have found a bug or if you want to request some enhancement, please:
1. Read the [Configuration](http://davdroid.bitfire.at/configuration) and [FAQ](http://davdroid.bitfire.at/faq/)
pages carefully. The most common issues/usage challenges are explained there.
2. Search the Web for the problem, maybe ask competent friends or in forums.
3. Browse through the [open issues](https://github.com/rfc2822/davdroid/issues). You can
also search the issues in the search field on top of the page. Please have a look
into the closed issues, too, because many requests have already been handled (and can''t/won''t
be fixed, for instance).
4. **[Fetch verbose logs](https://github.com/rfc2822/davdroid/wiki/How-to-view-the-logs) and prepare
them. Remove `Authorization: Basic xxxxxx` headers and other private data.** Extracting the
logs may be cumbersome work in the first time, but it''s absolutely necessary in order to
handle your issue.
5. Create a new issue, containing
* a useful summary of the problem ("Crash when syncing contacts with large photos" instead of "CRASH PLEASE HELP"),
* your DAVdroid version and source ("DAVdroid 0.5.10 from F-Droid"),
* your Android version and device model ("Samsung Galaxy S2 running Android 4.4.2 (CyanogenMod 11-20140504-SNAPSHOT-M6-i9100)"),
* your CalDAV/CardDAV server software, version and hosting information ("OwnCloud 6, hosted on virtual server"),
* **verbose logs including the network traffic** (see step before). Enquote the logs with three backticks ```
before and after, or post them onto http://gist.github.com and provide a link.
## Pull requests
We''re very happy about pull requests for
* source code,
* documentation,
* translation (strings).
However, if you want to contribute source code, please talk with us in the
corresponding issue before because will only merge pull requests that
* match our product goals,
* have the necessary code quality,
* don''t interfere with other near-term future development.
However, feel free to fork the repository and do your changes anyway
(that''s why it''s open-source). Just don''t expect your strategic changes to be
merged if there''s no consensus in the issue before.
## Donations
If you want to support this project, please also consider [donating to DAVdroid](http://davdroid.bitfire.at/donate)
or [purchasing it in one of the commercial stores](http://davdroid.bitfire.at/download).

View File

@ -1,7 +1,13 @@
Please see the [DAVdroid Web site](http://davdroid.bitfire.at) for more information.
DAVDROID
========
Twitter: https://twitter.com/davdroidapp
Please see the [DAVdroid Web site](http://davdroid.bitfire.at) for
detailled information about DAVdroid.
DAVdroid is licensed under the [GPLv3 License](COPYING).
Twitter: [@davdroidapp](https://twitter.com/davdroidapp)
USED THIRD-PARTY LIBRARIES

Binary file not shown.

After

Width:  |  Height:  |  Size: 409 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 384 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 481 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 530 B

View File

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android" >
<item android:title="@string/report_an_issue" android:showAsAction="always|withText" android:onClick="reportIssue" android:icon="@drawable/ic_action_new_event"></item>
</menu>

View File

@ -115,5 +115,6 @@
<string name="network_logging">Netzwerkverkehr aufzeichnen</string>
<string name="network_logging_enabled">Der gesamte Netzwerkverkehr wird in den Android-Logs mitgeschrieben (zur Fehlersuche)</string>
<string name="network_logging_disabled">Netzwerkverkehr wird nicht aufgezeichnet</string>
<string name="report_an_issue">Problem berichten</string>
</resources>

View File

@ -122,5 +122,6 @@
<string name="network_logging">Log network traffic</string>
<string name="network_logging_enabled">All network traffic is being logged verbosely (debug mode)</string>
<string name="network_logging_disabled">Network traffic is not being logged</string>
<string name="report_an_issue">Report an issue</string>
</resources>

View File

@ -42,9 +42,8 @@ public class AddAccountActivity extends Activity {
return true;
}
public boolean showHelp(MenuItem item) {
public void showHelp(MenuItem item) {
startActivityForResult(new Intent(Intent.ACTION_VIEW, Uri.parse(Constants.WEB_URL_HELP)), 0);
return true;
}
}

View File

@ -25,11 +25,14 @@ import android.content.AbstractThreadedSyncAdapter;
import android.content.ContentProviderClient;
import android.content.ContentResolver;
import android.content.Context;
import android.content.SharedPreferences;
import android.content.SyncResult;
import android.os.AsyncTask;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.provider.Settings;
import android.util.Log;
import at.bitfire.davdroid.Constants;
import at.bitfire.davdroid.resource.LocalCollection;
import at.bitfire.davdroid.resource.LocalStorageException;
import at.bitfire.davdroid.resource.RemoteCollection;
@ -106,7 +109,11 @@ public abstract class DavSyncAdapter extends AbstractThreadedSyncAdapter impleme
httpClientLock.writeLock().lock();
if (httpClient == null) {
Log.d(TAG, "Creating new DavHttpClient");
httpClient = DavHttpClient.create(getContext());
SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(getContext());
httpClient = DavHttpClient.create(
settings.getBoolean(Constants.SETTING_DISABLE_COMPRESSION, false),
settings.getBoolean(Constants.SETTING_NETWORK_LOGGING, false)
);
}
// prevent httpClient shutdown until we're ready by holding a read lock

View File

@ -2,11 +2,17 @@ package at.bitfire.davdroid.syncadapter;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.preference.PreferenceFragment;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import at.bitfire.davdroid.R;
public class GeneralSettingsActivity extends Activity {
final static String URL_REPORT_ISSUE = "https://github.com/rfc2822/davdroid/blob/master/CONTRIBUTING.md";
@Override
public void onCreate(Bundle savedInstanceState) {
@ -16,7 +22,11 @@ public class GeneralSettingsActivity extends Activity {
.replace(android.R.id.content, new GeneralSettingsFragment())
.commit();
}
public void reportIssue(MenuItem item) {
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(URL_REPORT_ISSUE)));
}
public static class GeneralSettingsFragment extends PreferenceFragment {
@Override
@ -25,6 +35,13 @@ public class GeneralSettingsActivity extends Activity {
getPreferenceManager().setSharedPreferencesMode(Context.MODE_MULTI_PROCESS);
addPreferencesFromResource(R.xml.general_settings);
setHasOptionsMenu(true);
}
@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
inflater.inflate(R.menu.debug_settings, menu);
}
}
}

View File

@ -114,7 +114,9 @@ public class QueryServerDialogFragment extends DialogFragment implements LoaderC
args.getBoolean(EXTRA_AUTH_PREEMPTIVE)
);
CloseableHttpClient httpClient = DavHttpClient.create(context);
// disable compression and enable network logging for debugging purposes
CloseableHttpClient httpClient = DavHttpClient.create(true, true);
try {
// (1/5) detect capabilities
WebDavResource base = new WebDavResource(httpClient, new URI(serverInfo.getProvidedURL()), serverInfo.getUserName(),

View File

@ -10,9 +10,6 @@
******************************************************************************/
package at.bitfire.davdroid.webdav;
import android.content.Context;
import android.content.SharedPreferences;
import android.preference.PreferenceManager;
import android.util.Log;
import at.bitfire.davdroid.Constants;
import ch.boye.httpclientandroidlib.client.config.RequestConfig;
@ -41,13 +38,13 @@ public class DavHttpClient {
// use request defaults from AndroidHttpClient
defaultRqConfig = RequestConfig.copy(RequestConfig.DEFAULT)
.setConnectTimeout(20*1000)
.setSocketTimeout(20*1000)
.setSocketTimeout(45*1000)
.setStaleConnectionCheckEnabled(false)
.build();
}
public static CloseableHttpClient create(Context context) {
public static CloseableHttpClient create(boolean disableCompression, boolean logTraffic) {
PoolingHttpClientConnectionManager connectionManager = new PoolingHttpClientConnectionManager(socketFactoryRegistry);
// limits per DavHttpClient (= per DavSyncAdapter extends AbstractThreadedSyncAdapter)
connectionManager.setMaxTotal(3); // max. 3 connections in total
@ -60,16 +57,16 @@ public class DavHttpClient {
.setRetryHandler(DavHttpRequestRetryHandler.INSTANCE)
.setUserAgent("DAVdroid/" + Constants.APP_VERSION)
.disableCookieManagement();
// debug options
SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(context);
if (settings.getBoolean(Constants.SETTING_DISABLE_COMPRESSION, false))
builder = builder.disableContentCompression();
boolean networkLogging = settings.getBoolean(Constants.SETTING_NETWORK_LOGGING, false);
Log.d(TAG, "Network logging: " + networkLogging);
ManagedHttpClientConnectionFactory.INSTANCE.wirelog.enableDebug(networkLogging);
ManagedHttpClientConnectionFactory.INSTANCE.log.enableDebug(networkLogging);
if (disableCompression) {
Log.d(TAG, "Disabling compression for debugging purposes");
builder = builder.disableContentCompression();
}
if (logTraffic)
Log.d(TAG, "Logging network traffic for debugging purposes");
ManagedHttpClientConnectionFactory.INSTANCE.wirelog.enableDebug(logTraffic);
ManagedHttpClientConnectionFactory.INSTANCE.log.enableDebug(logTraffic);
return builder.build();
}