Merge pull request #10550 from nextcloud/logOC

Log to Log_OC
This commit is contained in:
Álvaro Brey 2022-07-22 09:24:22 +02:00 committed by GitHub
commit 9e3f064b9c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
19 changed files with 53 additions and 67 deletions

View file

@ -22,8 +22,8 @@
package com.nextcloud.client
import android.util.Log
import com.owncloud.android.BuildConfig
import com.owncloud.android.lib.common.utils.Log_OC
import org.junit.rules.TestRule
import org.junit.runner.Description
import org.junit.runners.model.Statement
@ -49,7 +49,7 @@ class RetryTestRule(val retryCount: Int = defaultRetryValue) : TestRule {
return object : Statement() {
override fun evaluate() {
Log.d(TAG, "Evaluating ${description.methodName}")
Log_OC.d(TAG, "Evaluating ${description.methodName}")
var caughtThrowable: Throwable? = null
@ -59,11 +59,11 @@ class RetryTestRule(val retryCount: Int = defaultRetryValue) : TestRule {
return
} catch (t: Throwable) {
caughtThrowable = t
Log.e(TAG, description.methodName + ": run " + (i + 1) + " failed")
Log_OC.e(TAG, description.methodName + ": run " + (i + 1) + " failed")
}
}
Log.e(TAG, description.methodName + ": giving up after " + retryCount + " failures")
Log_OC.e(TAG, description.methodName + ": giving up after " + retryCount + " failures")
if (caughtThrowable != null)
throw caughtThrowable
}

View file

@ -12,12 +12,12 @@ import android.provider.DocumentsContract.buildChildDocumentsUriUsingTree
import android.provider.DocumentsContract.buildDocumentUriUsingTree
import android.provider.DocumentsContract.buildTreeDocumentUri
import android.provider.DocumentsContract.getDocumentId
import android.util.Log
import androidx.annotation.VisibleForTesting
import androidx.documentfile.provider.DocumentFile
import com.owncloud.android.datamodel.FileDataStorageManager
import com.owncloud.android.datamodel.OCFile
import com.owncloud.android.lib.common.OwnCloudClient
import com.owncloud.android.lib.common.utils.Log_OC
import com.owncloud.android.lib.resources.files.ExistenceCheckRemoteOperation
import com.owncloud.android.providers.DocumentsStorageProvider.DOCUMENTID_SEPARATOR
import kotlinx.coroutines.Dispatchers
@ -93,7 +93,7 @@ object DocumentsProviderUtils {
assertTrue(actualSet.containsAll(expectedSet))
actualSet.removeAll(expectedSet)
actualSet.forEach {
Log.e("TEST", "Error: Found unexpected file: $it")
Log_OC.e("TEST", "Error: Found unexpected file: $it")
}
}
@ -178,7 +178,7 @@ object DocumentsProviderUtils {
cont.invokeOnCancellation { cursor.close() }
val loading = cursor.extras.getBoolean(EXTRA_LOADING, false)
if (loading) {
Log.e("TEST", "Cursor was loading, wait for update...")
Log_OC.e("TEST", "Cursor was loading, wait for update...")
cursor.registerContentObserver(
object : ContentObserver(null) {
override fun onChange(selfChange: Boolean, uri: Uri?) {

View file

@ -1,12 +1,12 @@
package com.owncloud.android.providers
import android.provider.DocumentsContract
import android.util.Log
import androidx.documentfile.provider.DocumentFile
import com.nextcloud.test.RandomStringGenerator
import com.owncloud.android.AbstractOnServerIT
import com.owncloud.android.R
import com.owncloud.android.datamodel.OCFile.ROOT_PATH
import com.owncloud.android.lib.common.utils.Log_OC
import com.owncloud.android.providers.DocumentsProviderUtils.assertExistsOnServer
import com.owncloud.android.providers.DocumentsProviderUtils.assertListFilesEquals
import com.owncloud.android.providers.DocumentsProviderUtils.assertReadEquals
@ -60,7 +60,7 @@ class DocumentsStorageProviderIT : AbstractOnServerIT() {
@After
override fun after() = runBlocking {
rootDir.listFilesBlocking(context).forEach {
Log.e("TEST", "Deleting ${it.name}...")
Log_OC.e("TEST", "Deleting ${it.name}...")
it.delete()
}
}

View file

@ -20,9 +20,9 @@
package com.owncloud.android.utils
import android.app.Activity
import android.util.Log
import com.google.android.gms.common.ConnectionResult
import com.google.android.gms.common.GoogleApiAvailability
import com.owncloud.android.lib.common.utils.Log_OC
object GooglePlayUtils {
private const val PLAY_SERVICES_RESOLUTION_REQUEST = 9000
@ -36,7 +36,7 @@ object GooglePlayUtils {
if (apiAvailability.isUserResolvableError(resultCode)) {
apiAvailability.getErrorDialog(activity, resultCode, PLAY_SERVICES_RESOLUTION_REQUEST)?.show()
} else {
Log.i(TAG, "This device is not supported.")
Log_OC.i(TAG, "This device is not supported.")
activity.finish()
}
return false

View file

@ -30,7 +30,6 @@ import android.accounts.OperationCanceledException;
import android.content.Context;
import android.text.TextUtils;
import android.util.Base64;
import android.util.Log;
import com.google.gson.Gson;
import com.nextcloud.client.account.UserAccountManager;
@ -442,11 +441,11 @@ public final class PushUtils {
}
}
} catch (NoSuchAlgorithmException e) {
Log.d(TAG, "No such algorithm");
Log_OC.d(TAG, "No such algorithm");
} catch (InvalidKeyException e) {
Log.d(TAG, "Invalid key while trying to verify");
Log_OC.d(TAG, "Invalid key while trying to verify");
} catch (SignatureException e) {
Log.d(TAG, "Signature exception while trying to verify");
Log_OC.d(TAG, "Signature exception while trying to verify");
}
return new SignatureVerification(false, null);
@ -473,9 +472,9 @@ public final class PushUtils {
return keyFactory.generatePrivate(keySpec);
}
} catch (NoSuchAlgorithmException e) {
Log.d("TAG", "No such algorithm while reading key from string");
Log_OC.d("TAG", "No such algorithm while reading key from string");
} catch (InvalidKeySpecException e) {
Log.d("TAG", "Invalid key spec while reading key from string");
Log_OC.d("TAG", "Invalid key spec while reading key from string");
}
return null;

View file

@ -31,7 +31,6 @@ import android.net.Uri;
import android.os.Binder;
import android.os.ParcelFileDescriptor;
import android.text.TextUtils;
import android.util.Log;
import com.nextcloud.android.sso.aidl.IInputStreamService;
import com.nextcloud.android.sso.aidl.NextcloudRequest;
@ -137,7 +136,7 @@ public class InputStreamBinder extends IInputStreamService.Stub {
InputStream resultStream = new java.io.SequenceInputStream(exceptionStream, response.getBody());
return ParcelFileDescriptorUtil.pipeFrom(resultStream,
thread -> Log.d(TAG, "Done sending result"),
thread -> Log_OC.d(TAG, "Done sending result"),
response.getMethod());
} catch (IOException e) {
Log_OC.e(TAG, "Error while sending response back to client app", e);
@ -186,7 +185,7 @@ public class InputStreamBinder extends IInputStreamService.Stub {
resultStream = exceptionStream;
}
return ParcelFileDescriptorUtil.pipeFrom(resultStream,
thread -> Log.d(TAG, "Done sending result"),
thread -> Log_OC.d(TAG, "Done sending result"),
httpMethod);
} catch (IOException e) {
Log_OC.e(TAG, "Error while sending response back to client app", e);

View file

@ -33,7 +33,6 @@ import android.graphics.BitmapFactory
import android.media.RingtoneManager
import android.text.TextUtils
import android.util.Base64
import android.util.Log
import androidx.core.app.NotificationCompat
import androidx.core.app.NotificationManagerCompat
import androidx.work.Worker
@ -127,10 +126,10 @@ class NotificationWork constructor(
}
}
} catch (e1: GeneralSecurityException) {
Log.d(TAG, "Error decrypting message ${e1.javaClass.name} ${e1.localizedMessage}")
Log_OC.d(TAG, "Error decrypting message ${e1.javaClass.name} ${e1.localizedMessage}")
}
} catch (exception: Exception) {
Log.d(TAG, "Something went very wrong" + exception.localizedMessage)
Log_OC.d(TAG, "Something went very wrong" + exception.localizedMessage)
}
}
return Result.success()

View file

@ -25,12 +25,10 @@ import android.content.ContentResolver;
import android.database.Cursor;
import android.net.Uri;
import android.provider.MediaStore;
import android.util.Log;
import com.owncloud.android.MainApp;
import com.owncloud.android.lib.common.utils.Log_OC;
import com.owncloud.android.utils.PermissionUtil;
import com.owncloud.android.utils.theme.ThemeButtonUtils;
import com.owncloud.android.utils.theme.ThemeColorUtils;
import com.owncloud.android.utils.theme.ThemeSnackbarUtils;
import java.io.File;
@ -123,7 +121,7 @@ public final class MediaProvider {
MediaStore.Images.Media.DATE_TAKEN,
ContentResolverHelper.SORT_DIRECTION_DESCENDING,
itemLimit);
Log.d(TAG, "Reading images for " + mediaFolder.folderName);
Log_OC.d(TAG, "Reading images for " + mediaFolder.folderName);
if (cursorImages != null) {
String filePath;
@ -233,7 +231,7 @@ public final class MediaProvider {
ContentResolverHelper.SORT_DIRECTION_DESCENDING,
itemLimit);
Log.d(TAG, "Reading videos for " + mediaFolder.folderName);
Log_OC.d(TAG, "Reading videos for " + mediaFolder.folderName);
if (cursorVideos != null) {
String filePath;

View file

@ -21,7 +21,6 @@ package com.owncloud.android.operations;
import android.content.Context;
import android.content.Intent;
import android.util.Log;
import com.google.common.collect.Maps;
import com.google.gson.Gson;
@ -615,7 +614,7 @@ public class RefreshFolderOperation extends RemoteOperation {
remoteFile.getModificationTimestamp() !=
localFile.getModificationTimestamp()) {
updatedFile.setUpdateThumbnailNeeded(true);
Log.d(TAG, "Image " + remoteFile.getFileName() + " updated on the server");
Log_OC.d(TAG, "Image " + remoteFile.getFileName() + " updated on the server");
}
updatedFile.setSharedViaLink(localFile.isSharedViaLink());

View file

@ -23,7 +23,6 @@ package com.owncloud.android.operations;
import android.content.Context;
import android.content.Intent;
import android.text.TextUtils;
import android.util.Log;
import com.nextcloud.client.account.User;
import com.owncloud.android.datamodel.DecryptedFolderMetadata;
@ -364,7 +363,7 @@ public class SynchronizeFolderOperation extends SyncOperation {
remoteFile.getModificationTimestamp() !=
localFile.getModificationTimestamp()) {
updatedFile.setUpdateThumbnailNeeded(true);
Log.d(TAG, "Image " + remoteFile.getFileName() + " updated on the server");
Log_OC.d(TAG, "Image " + remoteFile.getFileName() + " updated on the server");
}
updatedFile.setSharedViaLink(localFile.isSharedViaLink());
updatedFile.setSharedWithSharee(localFile.isSharedWithSharee());

View file

@ -25,7 +25,6 @@ import android.annotation.SuppressLint;
import android.content.Context;
import android.net.Uri;
import android.text.TextUtils;
import android.util.Log;
import android.util.Pair;
import com.nextcloud.client.account.User;
@ -1020,7 +1019,7 @@ public class UploadFileOperation extends SyncOperation {
try {
move(originalFile, newFile);
} catch (IOException e) {
Log.e(TAG, "Error moving file", e);
Log_OC.e(TAG, "Error moving file", e);
}
getStorageManager().deleteFileInMediaScan(originalFile.getAbsolutePath());
mFile.setStoragePath(newFile.getAbsolutePath());

View file

@ -39,7 +39,6 @@ import android.os.Looper;
import android.os.ParcelFileDescriptor;
import android.provider.DocumentsContract;
import android.provider.DocumentsProvider;
import android.util.Log;
import android.widget.Toast;
import com.nextcloud.client.account.User;
@ -149,7 +148,7 @@ public class DocumentsStorageProvider extends DocumentsProvider {
@Override
public Cursor queryDocument(String documentId, String[] projection) throws FileNotFoundException {
Log.d(TAG, "queryDocument(), id=" + documentId);
Log_OC.d(TAG, "queryDocument(), id=" + documentId);
Document document = toDocument(documentId);
@ -163,7 +162,7 @@ public class DocumentsStorageProvider extends DocumentsProvider {
@Override
public Cursor queryChildDocuments(String parentDocumentId, String[] projection, String sortOrder)
throws FileNotFoundException {
Log.d(TAG, "queryChildDocuments(), id=" + parentDocumentId);
Log_OC.d(TAG, "queryChildDocuments(), id=" + parentDocumentId);
Context context = getNonNullContext();
Document parentFolder = toDocument(parentDocumentId);
@ -194,7 +193,7 @@ public class DocumentsStorageProvider extends DocumentsProvider {
@Override
public ParcelFileDescriptor openDocument(String documentId, String mode, CancellationSignal cancellationSignal)
throws FileNotFoundException {
Log.d(TAG, "openDocument(), id=" + documentId);
Log_OC.d(TAG, "openDocument(), id=" + documentId);
Document document = toDocument(documentId);
Context context = getNonNullContext();
@ -338,7 +337,7 @@ public class DocumentsStorageProvider extends DocumentsProvider {
Point sizeHint,
CancellationSignal signal)
throws FileNotFoundException {
Log.d(TAG, "openDocumentThumbnail(), id=" + documentId);
Log_OC.d(TAG, "openDocumentThumbnail(), id=" + documentId);
Document document = toDocument(documentId);
OCFile file = document.getFile();
@ -356,7 +355,7 @@ public class DocumentsStorageProvider extends DocumentsProvider {
@Override
public String renameDocument(String documentId, String displayName) throws FileNotFoundException {
Log.d(TAG, "renameDocument(), id=" + documentId);
Log_OC.d(TAG, "renameDocument(), id=" + documentId);
Document document = toDocument(documentId);
@ -379,7 +378,7 @@ public class DocumentsStorageProvider extends DocumentsProvider {
@Override
public String copyDocument(String sourceDocumentId, String targetParentDocumentId) throws FileNotFoundException {
Log.d(TAG, "copyDocument(), id=" + sourceDocumentId);
Log_OC.d(TAG, "copyDocument(), id=" + sourceDocumentId);
Document document = toDocument(sourceDocumentId);
@ -431,7 +430,7 @@ public class DocumentsStorageProvider extends DocumentsProvider {
@Override
public String moveDocument(String sourceDocumentId, String sourceParentDocumentId, String targetParentDocumentId)
throws FileNotFoundException {
Log.d(TAG, "moveDocument(), id=" + sourceDocumentId);
Log_OC.d(TAG, "moveDocument(), id=" + sourceDocumentId);
Document document = toDocument(sourceDocumentId);
Document targetFolder = toDocument(targetParentDocumentId);
@ -458,7 +457,7 @@ public class DocumentsStorageProvider extends DocumentsProvider {
@Override
public Cursor querySearchDocuments(String rootId, String query, String[] projection) {
Log.d(TAG, "querySearchDocuments(), rootId=" + rootId);
Log_OC.d(TAG, "querySearchDocuments(), rootId=" + rootId);
FileCursor result = new FileCursor(projection);
@ -476,7 +475,7 @@ public class DocumentsStorageProvider extends DocumentsProvider {
@Override
public String createDocument(String documentId, String mimeType, String displayName) throws FileNotFoundException {
Log.d(TAG, "createDocument(), id=" + documentId);
Log_OC.d(TAG, "createDocument(), id=" + documentId);
Document folderDocument = toDocument(documentId);
@ -598,7 +597,7 @@ public class DocumentsStorageProvider extends DocumentsProvider {
@Override
public void deleteDocument(String documentId) throws FileNotFoundException {
Log.d(TAG, "deleteDocument(), id=" + documentId);
Log_OC.d(TAG, "deleteDocument(), id=" + documentId);
Context context = getNonNullContext();
@ -637,7 +636,7 @@ public class DocumentsStorageProvider extends DocumentsProvider {
@Override
public boolean isChildDocument(String parentDocumentId, String documentId) {
Log.d(TAG, "isChildDocument(), parent=" + parentDocumentId + ", id=" + documentId);
Log_OC.d(TAG, "isChildDocument(), parent=" + parentDocumentId + ", id=" + documentId);
try {
// get file for parent document
@ -667,7 +666,7 @@ public class DocumentsStorageProvider extends DocumentsProvider {
return parentDocumentOwner.nameEquals(currentDocumentOwner) && childPath.startsWith(parentPath);
} catch (FileNotFoundException e) {
Log.e(TAG, "failed to check for child document", e);
Log_OC.e(TAG, "failed to check for child document", e);
}
return false;
@ -763,7 +762,7 @@ public class DocumentsStorageProvider extends DocumentsProvider {
@Override
public final RemoteOperationResult doInBackground(Void... params) {
Log.d(TAG, "run ReloadFolderDocumentTask(), id=" + folder.getDocumentId());
Log_OC.d(TAG, "run ReloadFolderDocumentTask(), id=" + folder.getDocumentId());
return new RefreshFolderOperation(folder.getFile(),
System.currentTimeMillis(),
false,

View file

@ -27,7 +27,6 @@ import android.content.IntentFilter
import android.content.res.Resources
import android.os.Bundle
import android.os.Parcelable
import android.util.Log
import android.view.ActionMode
import android.view.Menu
import android.view.MenuItem
@ -184,7 +183,7 @@ open class FolderPickerActivity :
listFragment.setEmptyListLoadingMessage()
}
} else {
Log.e(TAG, "OCFileListFragment is null")
Log_OC.e(TAG, "OCFileListFragment is null")
}
}

View file

@ -37,7 +37,6 @@ import android.text.Spannable;
import android.text.SpannableStringBuilder;
import android.text.style.ForegroundColorSpan;
import android.text.style.StyleSpan;
import android.util.Log;
import com.nextcloud.android.sso.Constants;
import com.owncloud.android.MainApp;
@ -86,11 +85,11 @@ public class SsoGrantPermissionActivity extends BaseActivity {
getString(R.string.single_sign_on_request_token, appName, account.name),
appName,
account.name));
Log.v(TAG, "TOKEN-REQUEST: Calling Package: " + packageName);
Log.v(TAG, "TOKEN-REQUEST: App Name: " + appName);
Log_OC.v(TAG, "TOKEN-REQUEST: Calling Package: " + packageName);
Log_OC.v(TAG, "TOKEN-REQUEST: App Name: " + appName);
} else {
// Activity was not started using startActivityForResult!
Log.e(TAG, "Calling Package is null");
Log_OC.e(TAG, "Calling Package is null");
setResultAndExit("Request was not executed properly. Use startActivityForResult()");
}
@ -100,7 +99,7 @@ public class SsoGrantPermissionActivity extends BaseActivity {
binding.appIcon.setImageDrawable(appIcon);
}
} catch (PackageManager.NameNotFoundException e) {
Log.e(TAG, "Error retrieving app icon", e);
Log_OC.e(TAG, "Error retrieving app icon", e);
}
binding.btnDecline.setOnClickListener(v -> exitFailed());
@ -133,7 +132,7 @@ public class SsoGrantPermissionActivity extends BaseActivity {
try {
ai = pm.getApplicationInfo(pkg, 0);
} catch (final PackageManager.NameNotFoundException e) {
Log.e(TAG, "Error fetching app name for package", e);
Log_OC.e(TAG, "Error fetching app name for package", e);
}
return (String) (ai != null ? pm.getApplicationLabel(ai) : "(unknown)");
}

View file

@ -30,7 +30,6 @@ import android.os.Bundle
import android.os.PowerManager
import android.provider.Settings
import android.text.TextUtils
import android.util.Log
import android.view.Menu
import android.view.MenuItem
import android.view.View
@ -59,6 +58,7 @@ import com.owncloud.android.datamodel.SyncedFolderDisplayItem
import com.owncloud.android.datamodel.SyncedFolderProvider
import com.owncloud.android.files.services.FileUploader
import com.owncloud.android.files.services.NameCollisionPolicy
import com.owncloud.android.lib.common.utils.Log_OC
import com.owncloud.android.ui.adapter.SyncedFolderAdapter
import com.owncloud.android.ui.decoration.MediaGridItemDecoration
import com.owncloud.android.ui.dialog.SyncedFolderPreferencesDialogFragment
@ -526,7 +526,7 @@ class SyncedFoldersActivity :
when (item.itemId) {
android.R.id.home -> finish()
R.id.action_create_custom_folder -> {
Log.d(TAG, "Show custom folder dialog")
Log_OC.d(TAG, "Show custom folder dialog")
if (PermissionUtil.checkExternalStoragePermission(this)) {
val emptyCustomFolder = SyncedFolderDisplayItem(
SyncedFolder.UNPERSISTED_ID,

View file

@ -20,11 +20,11 @@
package com.owncloud.android.ui.adapter;
import android.content.Context;
import android.util.Log;
import android.view.View;
import com.owncloud.android.R;
import com.owncloud.android.databinding.SslUntrustedCertLayoutBinding;
import com.owncloud.android.lib.common.utils.Log_OC;
import com.owncloud.android.ui.dialog.SslUntrustedCertDialog;
import java.security.MessageDigest;
@ -93,7 +93,7 @@ public class X509CertificateViewAdapter implements SslUntrustedCertDialog.Certif
binding.valueSignatureAlgorithm.setText(mCertificate.getSigAlgName());
}
} catch (CertificateEncodingException e) {
Log.e(TAG, "Problem while trying to decode the certificate.");
Log_OC.e(TAG, "Problem while trying to decode the certificate.");
}
}

View file

@ -43,7 +43,6 @@ import android.os.Environment;
import android.os.StatFs;
import android.provider.MediaStore;
import android.text.TextUtils;
import android.util.Log;
import android.view.View;
import android.webkit.MimeTypeMap;
@ -277,7 +276,7 @@ public class FileOperationsHelper {
try {
Thread.sleep(3000);
} catch (InterruptedException e) {
Log.e(TAG, "Failed to sleep for a bit");
Log_OC.e(TAG, "Failed to sleep for a bit");
}
}
}
@ -356,7 +355,7 @@ public class FileOperationsHelper {
try {
Thread.sleep(3000);
} catch (InterruptedException e) {
Log.e(TAG, "Failed to sleep");
Log_OC.e(TAG, "Failed to sleep");
}
}

View file

@ -45,7 +45,6 @@ import android.text.TextUtils;
import android.text.format.DateUtils;
import android.text.style.StyleSpan;
import android.util.DisplayMetrics;
import android.util.Log;
import android.view.View;
import android.view.WindowManager;
import android.widget.FrameLayout;
@ -765,7 +764,7 @@ public final class DisplayUtils {
addDelegate.setAccessible(true);
addDelegate.invoke(drawableManager, "vector", vdcInflateDelegate);
} catch (Exception e) {
Log.e(TAG, "Failed to use reflection to enable proper vector scaling");
Log_OC.e(TAG, "Failed to use reflection to enable proper vector scaling");
}
}

View file

@ -26,7 +26,6 @@ import android.content.res.Resources;
import android.net.Uri;
import android.os.Environment;
import android.text.TextUtils;
import android.util.Log;
import android.webkit.MimeTypeMap;
import com.owncloud.android.MainApp;
@ -448,7 +447,7 @@ public final class FileStorageUtils {
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
Log.d(TAG, "Failed to sleep for a bit");
Log_OC.d(TAG, "Failed to sleep for a bit");
}
}
}