Disable debug & verbose logging on release builds.
This commit is contained in:
parent
54096c3249
commit
bf0350776c
4 changed files with 31 additions and 11 deletions
|
@ -11,12 +11,6 @@ android {
|
|||
versionName "1.0"
|
||||
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
|
||||
|
||||
externalNativeBuild {
|
||||
cmake {
|
||||
cppFlags ""
|
||||
}
|
||||
}
|
||||
|
||||
ndk {
|
||||
abiFilters 'armeabi-v7a'
|
||||
abiFilters 'arm64-v8a'
|
||||
|
@ -28,9 +22,23 @@ android {
|
|||
release {
|
||||
minifyEnabled false
|
||||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
||||
|
||||
externalNativeBuild {
|
||||
cmake {
|
||||
cppFlags ""
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
debug {
|
||||
jniDebuggable true
|
||||
|
||||
externalNativeBuild {
|
||||
cmake {
|
||||
cppFlags "-DDEBUG"
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
externalNativeBuild {
|
||||
|
|
|
@ -23,10 +23,20 @@
|
|||
#define LOG(level, tag, args...) \
|
||||
__android_log_print((level), (tag), args)
|
||||
|
||||
#ifdef DEBUG
|
||||
|
||||
#define LOGV(tag, args...) LOG(ANDROID_LOG_VERBOSE, tag, args)
|
||||
|
||||
#define LOGD(tag, args...) LOG(ANDROID_LOG_DEBUG, tag, args)
|
||||
|
||||
#else // DEBUG
|
||||
|
||||
#define LOGV(tag, args...)
|
||||
|
||||
#define LOGD(tag, args...)
|
||||
|
||||
#endif // DEBUG
|
||||
|
||||
#define LOGI(tag, args...) LOG(ANDROID_LOG_INFO, tag, args)
|
||||
|
||||
#define LOGW(tag, args...) LOG(ANDROID_LOG_WARN, tag, args)
|
||||
|
|
|
@ -24,6 +24,7 @@ import android.os.AsyncTask.Status;
|
|||
import android.os.Bundle;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.util.Log;
|
||||
import com.google.android.sambadocumentsprovider.BuildConfig;
|
||||
|
||||
/**
|
||||
* Use this class to avoid using {@link Cursor#setExtras(Bundle)} on API level < 23.
|
||||
|
@ -57,7 +58,7 @@ public class DocumentCursor extends MatrixCursor {
|
|||
public void close() {
|
||||
super.close();
|
||||
if (mLoadingTask != null && mLoadingTask.getStatus() != Status.FINISHED) {
|
||||
Log.d(TAG, "Cursor is closed. Cancel the loading task " + mLoadingTask);
|
||||
if(BuildConfig.DEBUG) Log.d(TAG, "Cursor is closed. Cancel the loading task " + mLoadingTask);
|
||||
// Interrupting the task is not a good choice as it's waiting for the Samba client thread
|
||||
// returning the result. Interrupting the task only frees the task from waiting for the
|
||||
// result, rather than freeing the Samba client thread doing the hard work.
|
||||
|
|
|
@ -39,6 +39,7 @@ import android.provider.DocumentsProvider;
|
|||
import android.support.annotation.Nullable;
|
||||
import android.support.annotation.StringRes;
|
||||
import android.util.Log;
|
||||
import com.google.android.sambadocumentsprovider.BuildConfig;
|
||||
import com.google.android.sambadocumentsprovider.R;
|
||||
import com.google.android.sambadocumentsprovider.SambaProviderApplication;
|
||||
import com.google.android.sambadocumentsprovider.ShareManager;
|
||||
|
@ -160,7 +161,7 @@ public class SambaDocumentsProvider extends DocumentsProvider {
|
|||
|
||||
@Override
|
||||
public Cursor queryRoots(String[] projection) throws FileNotFoundException {
|
||||
Log.d(TAG, "Querying roots.");
|
||||
if(BuildConfig.DEBUG) Log.d(TAG, "Querying roots.");
|
||||
projection = (projection == null) ? DEFAULT_ROOT_PROJECTION : projection;
|
||||
|
||||
MatrixCursor cursor = new MatrixCursor(projection, mShareManager.size());
|
||||
|
@ -200,7 +201,7 @@ public class SambaDocumentsProvider extends DocumentsProvider {
|
|||
|
||||
@Override
|
||||
public Cursor queryDocument(String documentId, String[] projection) throws FileNotFoundException {
|
||||
Log.d(TAG, "Querying document: " + documentId);
|
||||
if (BuildConfig.DEBUG) Log.d(TAG, "Querying document: " + documentId);
|
||||
projection = (projection == null) ? DEFAULT_DOCUMENT_PROJECTION : projection;
|
||||
|
||||
final Uri uri = toUri(documentId);
|
||||
|
@ -235,7 +236,7 @@ public class SambaDocumentsProvider extends DocumentsProvider {
|
|||
@Override
|
||||
public Cursor queryChildDocuments(String documentId, String[] projection, String sortOrder)
|
||||
throws FileNotFoundException {
|
||||
Log.d(TAG, "Querying children documents under " + documentId);
|
||||
if (BuildConfig.DEBUG) Log.d(TAG, "Querying children documents under " + documentId);
|
||||
projection = (projection == null) ? DEFAULT_DOCUMENT_PROJECTION : projection;
|
||||
|
||||
final Uri uri = toUri(documentId);
|
||||
|
@ -555,7 +556,7 @@ public class SambaDocumentsProvider extends DocumentsProvider {
|
|||
@Override
|
||||
public ParcelFileDescriptor openDocument(String documentId, String mode,
|
||||
CancellationSignal cancellationSignal) throws FileNotFoundException {
|
||||
Log.d(TAG, "Opening document " + documentId + " with mode " + mode);
|
||||
if (BuildConfig.DEBUG) Log.d(TAG, "Opening document " + documentId + " with mode " + mode);
|
||||
|
||||
try {
|
||||
final String uri = toUriString(documentId);
|
||||
|
|
Loading…
Reference in a new issue