diff options
author | 2024-12-16 20:43:05 -0800 | |
---|---|---|
committer | 2024-12-16 20:43:05 -0800 | |
commit | a7fc30a11222a035fc9f2448d08e471413380f79 (patch) | |
tree | 575fd533fbac3f244b5b99d4a2544caca8f68ec4 | |
parent | 6213e14fa47c4b3f993407a17206156ef54232ff (diff) | |
parent | 55f960c3175ed38352426089f7076e5dac5c6132 (diff) |
Merge "Add and tweak logs in ResolvedResourcesJob" into main
-rw-r--r-- | src/com/android/documentsui/services/ResolvedResourcesJob.java | 27 |
1 files changed, 19 insertions, 8 deletions
diff --git a/src/com/android/documentsui/services/ResolvedResourcesJob.java b/src/com/android/documentsui/services/ResolvedResourcesJob.java index 500958978..a6001d5f8 100644 --- a/src/com/android/documentsui/services/ResolvedResourcesJob.java +++ b/src/com/android/documentsui/services/ResolvedResourcesJob.java @@ -16,6 +16,10 @@ package com.android.documentsui.services; +import static android.os.SystemClock.uptimeMillis; + +import static com.android.documentsui.base.SharedMinimal.DEBUG; + import android.content.ContentResolver; import android.content.Context; import android.net.Uri; @@ -44,6 +48,9 @@ import java.util.List; public abstract class ResolvedResourcesJob extends Job { private static final String TAG = "ResolvedResourcesJob"; + // Used in logs. + protected final long mStartTime = uptimeMillis(); + final List<DocumentInfo> mResolvedDocs; final List<Uri> mAcquiredArchivedUris = new ArrayList<>(); @@ -72,22 +79,22 @@ public abstract class ResolvedResourcesJob extends Job { mAcquiredArchivedUris.add(uri); } } catch (RemoteException e) { - Log.e(TAG, "Failed to acquire an archive."); + Log.e(TAG, "Cannot acquire an archive", e); return false; } } } catch (IOException e) { - Log.e(TAG, "Failed to read list of target resource Uris. Cannot continue.", e); + Log.e(TAG, "Cannot read list of target resource URIs", e); return false; } int docsResolved = buildDocumentList(); if (!isCanceled() && docsResolved < mResourceUris.getItemCount()) { if (docsResolved == 0) { - Log.e(TAG, "Failed to load any documents. Aborting."); + Log.e(TAG, "Cannot load any documents. Aborting."); return false; } else { - Log.e(TAG, "Failed to load some documents. Processing loaded documents only."); + Log.e(TAG, "Cannot load some documents"); } } @@ -101,9 +108,14 @@ public abstract class ResolvedResourcesJob extends Job { try { ArchivesProvider.releaseArchive(getClient(uri), uri); } catch (RemoteException e) { - Log.e(TAG, "Failed to release an archived document."); + Log.e(TAG, "Cannot release an archived document", e); } } + + if (DEBUG) { + Log.d(TAG, String.format("%s %s finished after %d ms", getClass().getSimpleName(), id, + uptimeMillis() - mStartTime)); + } } /** @@ -123,7 +135,7 @@ public abstract class ResolvedResourcesJob extends Job { try { uris = mResourceUris.getUris(appContext); } catch (IOException e) { - Log.e(TAG, "Failed to read list of target resource Uris. Cannot continue.", e); + Log.e(TAG, "Cannot read list of target resource URIs", e); failureCount = this.mResourceUris.getItemCount(); return 0; } @@ -135,8 +147,7 @@ public abstract class ResolvedResourcesJob extends Job { try { doc = DocumentInfo.fromUri(resolver, uri, UserId.DEFAULT_USER); } catch (FileNotFoundException e) { - Log.e(TAG, "Failed to resolve content from Uri: " + uri - + ". Skipping to next resource.", e); + Log.e(TAG, "Cannot resolve content from URI " + uri, e); onResolveFailed(uri); continue; } |