From 33819318f61224cdda45e5e9a70dc9cdb9f33911 Mon Sep 17 00:00:00 2001 From: Jeff Sharkey Date: Tue, 29 Oct 2013 11:56:37 -0700 Subject: Suppress OperationCanceledException logging. These exceptions are normal when an app has cancelled an outstanding thumbnail request. Bug: 11385378 Change-Id: I8aed5721b447cda5baf447ac7afd627aa1062863 --- core/java/android/provider/DocumentsContract.java | 5 ++++- .../DocumentsUI/src/com/android/documentsui/DirectoryFragment.java | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/core/java/android/provider/DocumentsContract.java b/core/java/android/provider/DocumentsContract.java index 09f5fe3..86d3cf8 100644 --- a/core/java/android/provider/DocumentsContract.java +++ b/core/java/android/provider/DocumentsContract.java @@ -34,6 +34,7 @@ import android.media.ExifInterface; import android.net.Uri; import android.os.Bundle; import android.os.CancellationSignal; +import android.os.OperationCanceledException; import android.os.ParcelFileDescriptor; import android.os.ParcelFileDescriptor.OnCloseListener; import android.os.RemoteException; @@ -670,7 +671,9 @@ public final class DocumentsContract { try { return getDocumentThumbnail(client, documentUri, size, signal); } catch (Exception e) { - Log.w(TAG, "Failed to load thumbnail for " + documentUri + ": " + e); + if (!(e instanceof OperationCanceledException)) { + Log.w(TAG, "Failed to load thumbnail for " + documentUri + ": " + e); + } return null; } finally { ContentProviderClient.releaseQuietly(client); diff --git a/packages/DocumentsUI/src/com/android/documentsui/DirectoryFragment.java b/packages/DocumentsUI/src/com/android/documentsui/DirectoryFragment.java index 775720e..b2b2bd8 100644 --- a/packages/DocumentsUI/src/com/android/documentsui/DirectoryFragment.java +++ b/packages/DocumentsUI/src/com/android/documentsui/DirectoryFragment.java @@ -47,6 +47,7 @@ import android.net.Uri; import android.os.AsyncTask; import android.os.Bundle; import android.os.CancellationSignal; +import android.os.OperationCanceledException; import android.os.Parcelable; import android.provider.DocumentsContract; import android.provider.DocumentsContract.Document; @@ -1028,7 +1029,9 @@ public class DirectoryFragment extends Fragment { thumbs.put(mUri, result); } } catch (Exception e) { - Log.w(TAG, "Failed to load thumbnail for " + mUri + ": " + e); + if (!(e instanceof OperationCanceledException)) { + Log.w(TAG, "Failed to load thumbnail for " + mUri + ": " + e); + } } finally { ContentProviderClient.releaseQuietly(client); } -- cgit v1.1