From ebcc93801eb9545004536587d10f82db378aeab5 Mon Sep 17 00:00:00 2001 From: Jeff Sharkey Date: Fri, 20 Jul 2012 16:06:35 -0700 Subject: Reduce deletion logging. Bug: 6544953 Change-Id: I4157c67b9b9cddab4ade795c328a202f6a230f95 --- .../android/providers/downloads/DownloadService.java | 9 ++++++--- src/com/android/providers/downloads/DownloadThread.java | 17 +++++++++++------ src/com/android/providers/downloads/StorageManager.java | 11 ++++++----- 3 files changed, 23 insertions(+), 14 deletions(-) diff --git a/src/com/android/providers/downloads/DownloadService.java b/src/com/android/providers/downloads/DownloadService.java index 3b566f8e..55efefcf 100644 --- a/src/com/android/providers/downloads/DownloadService.java +++ b/src/com/android/providers/downloads/DownloadService.java @@ -38,7 +38,6 @@ import android.os.RemoteException; import android.provider.Downloads; import android.text.TextUtils; import android.util.Log; -import android.util.Slog; import com.android.internal.util.IndentingPrintWriter; import com.google.android.collect.Maps; @@ -483,7 +482,9 @@ public class DownloadService extends Service { info.mStatus = Downloads.Impl.STATUS_CANCELED; } if (info.mDestination != Downloads.Impl.DESTINATION_EXTERNAL && info.mFileName != null) { - Slog.d(TAG, "deleteDownloadLocked() deleting " + info.mFileName); + if (Constants.LOGVV) { + Log.d(TAG, "deleteDownloadLocked() deleting " + info.mFileName); + } new File(info.mFileName).delete(); } mSystemFacade.cancelNotification(info.mId); @@ -559,7 +560,9 @@ public class DownloadService extends Service { private void deleteFileIfExists(String path) { try { if (!TextUtils.isEmpty(path)) { - Slog.d(TAG, "deleteFileIfExists() deleting " + path); + if (Constants.LOGVV) { + Log.d(TAG, "deleteFileIfExists() deleting " + path); + } File file = new File(path); file.delete(); } diff --git a/src/com/android/providers/downloads/DownloadThread.java b/src/com/android/providers/downloads/DownloadThread.java index bd91eaa1..37db32b1 100644 --- a/src/com/android/providers/downloads/DownloadThread.java +++ b/src/com/android/providers/downloads/DownloadThread.java @@ -33,7 +33,6 @@ import android.provider.Downloads; import android.text.TextUtils; import android.util.Log; import android.util.Pair; -import android.util.Slog; import org.apache.http.Header; import org.apache.http.HttpResponse; @@ -330,7 +329,9 @@ public class DownloadThread extends Thread { closeDestination(state); if (state.mFilename != null && Downloads.Impl.isStatusError(finalStatus)) { - Slog.d(TAG, "cleanupDestination() deleting " + state.mFilename); + if (Constants.LOGVV) { + Log.d(TAG, "cleanupDestination() deleting " + state.mFilename); + } new File(state.mFilename).delete(); state.mFilename = null; } @@ -847,8 +848,10 @@ public class DownloadThread extends Thread { long fileLength = f.length(); if (fileLength == 0) { // The download hadn't actually started, we can restart from scratch - Slog.d(TAG, "setupDestinationFile() found fileLength=0, deleting " - + state.mFilename); + if (Constants.LOGVV) { + Log.d(TAG, "setupDestinationFile() found fileLength=0, deleting " + + state.mFilename); + } f.delete(); state.mFilename = null; if (Constants.LOGV) { @@ -857,8 +860,10 @@ public class DownloadThread extends Thread { } } else if (mInfo.mETag == null && !mInfo.mNoIntegrity) { // This should've been caught upon failure - Slog.d(TAG, "setupDestinationFile() unable to resume download, deleting " - + state.mFilename); + if (Constants.LOGVV) { + Log.d(TAG, "setupDestinationFile() unable to resume download, deleting " + + state.mFilename); + } f.delete(); throw new StopRequestException(Downloads.Impl.STATUS_CANNOT_RESUME, "Trying to resume a download that can't be resumed"); diff --git a/src/com/android/providers/downloads/StorageManager.java b/src/com/android/providers/downloads/StorageManager.java index 4b51921f..915d141b 100644 --- a/src/com/android/providers/downloads/StorageManager.java +++ b/src/com/android/providers/downloads/StorageManager.java @@ -30,7 +30,6 @@ import android.os.StatFs; import android.provider.Downloads; import android.text.TextUtils; import android.util.Log; -import android.util.Slog; import com.android.internal.R; @@ -342,9 +341,9 @@ class StorageManager { if (TextUtils.isEmpty(data)) continue; File file = new File(data); - if (true || Constants.LOGV) { - Slog.d(Constants.TAG, "purging " + file.getAbsolutePath() + " for " + - file.length() + " bytes"); + if (Constants.LOGV) { + Log.d(Constants.TAG, "purging " + file.getAbsolutePath() + " for " + + file.length() + " bytes"); } totalFreed += file.length(); file.delete(); @@ -416,7 +415,9 @@ class StorageManager { try { final StructStat stat = Libcore.os.stat(path); if (stat.st_uid == myUid) { - Slog.d(TAG, "deleting spurious file " + path); + if (Constants.LOGVV) { + Log.d(TAG, "deleting spurious file " + path); + } file.delete(); } } catch (ErrnoException e) { -- cgit v1.2.3