From 9b731a5521f569c91aeb419d43fa098a34cf78cb Mon Sep 17 00:00:00 2001 From: Doug Zongker Date: Mon, 27 Jan 2014 11:19:19 -0800 Subject: Revert "change download provider to use system log" This reverts commit 4f9d2d04003fafb358d7c127054055b3a9732c9b, was only wanted for debugging. --- src/com/android/providers/downloads/Constants.java | 6 +-- .../providers/downloads/DownloadProvider.java | 52 +++++++++++----------- .../providers/downloads/DownloadReceiver.java | 14 +++--- .../providers/downloads/DownloadScanner.java | 6 +-- .../providers/downloads/DownloadService.java | 30 ++++++------- .../providers/downloads/DownloadThread.java | 36 +++++++-------- .../providers/downloads/StorageManager.java | 32 ++++++------- 7 files changed, 88 insertions(+), 88 deletions(-) (limited to 'src') diff --git a/src/com/android/providers/downloads/Constants.java b/src/com/android/providers/downloads/Constants.java index 15795078..89210a25 100644 --- a/src/com/android/providers/downloads/Constants.java +++ b/src/com/android/providers/downloads/Constants.java @@ -168,11 +168,11 @@ public class Constants { static final boolean LOGX = false; /** Enable verbose logging - use with "setprop log.tag.DownloadManager VERBOSE" */ - private static final boolean LOCAL_LOGV = true; - public static final boolean LOGV = true; //LOCAL_LOGV && Log.isLoggable(TAG, Log.VERBOSE); + private static final boolean LOCAL_LOGV = false; + public static final boolean LOGV = LOCAL_LOGV && Log.isLoggable(TAG, Log.VERBOSE); /** Enable super-verbose logging */ - private static final boolean LOCAL_LOGVV = true; + private static final boolean LOCAL_LOGVV = false; public static final boolean LOGVV = LOCAL_LOGVV && LOGV; public static final String STORAGE_AUTHORITY = "com.android.providers.downloads.documents"; diff --git a/src/com/android/providers/downloads/DownloadProvider.java b/src/com/android/providers/downloads/DownloadProvider.java index 7e4e0802..ad3cf7ac 100644 --- a/src/com/android/providers/downloads/DownloadProvider.java +++ b/src/com/android/providers/downloads/DownloadProvider.java @@ -45,7 +45,7 @@ import android.provider.Downloads; import android.provider.OpenableColumns; import android.text.TextUtils; import android.text.format.DateUtils; -import android.util.Slog; +import android.util.Log; import com.android.internal.util.IndentingPrintWriter; import com.google.android.collect.Maps; @@ -237,7 +237,7 @@ public final class DownloadProvider extends ContentProvider { @Override public void onCreate(final SQLiteDatabase db) { if (Constants.LOGVV) { - Slog.v(Constants.TAG, "populating new database"); + Log.v(Constants.TAG, "populating new database"); } onUpgrade(db, 0, DB_VERSION); } @@ -257,13 +257,13 @@ public final class DownloadProvider extends ContentProvider { oldV = 100; } else if (oldV < 100) { // no logic to upgrade from these older version, just recreate the DB - Slog.i(Constants.TAG, "Upgrading downloads database from version " + oldV + Log.i(Constants.TAG, "Upgrading downloads database from version " + oldV + " to version " + newV + ", which will destroy all old data"); oldV = 99; } else if (oldV > newV) { // user must have downgraded software; we have no way to know how to downgrade the // DB, so just recreate it - Slog.i(Constants.TAG, "Downgrading downloads database from version " + oldV + Log.i(Constants.TAG, "Downgrading downloads database from version " + oldV + " (current version is " + newV + "), destroying all old data"); oldV = 99; } @@ -418,7 +418,7 @@ public final class DownloadProvider extends ContentProvider { Downloads.Impl.COLUMN_DESCRIPTION + " TEXT, " + Constants.MEDIA_SCANNED + " BOOLEAN);"); } catch (SQLException ex) { - Slog.e(Constants.TAG, "couldn't create table in downloads database"); + Log.e(Constants.TAG, "couldn't create table in downloads database"); throw ex; } } @@ -455,7 +455,7 @@ public final class DownloadProvider extends ContentProvider { appInfo = getContext().getPackageManager(). getApplicationInfo("com.android.defcontainer", 0); } catch (NameNotFoundException e) { - Slog.wtf(Constants.TAG, "Could not get ApplicationInfo for com.android.defconatiner", e); + Log.wtf(Constants.TAG, "Could not get ApplicationInfo for com.android.defconatiner", e); } if (appInfo != null) { mDefContainerUid = appInfo.uid; @@ -468,7 +468,7 @@ public final class DownloadProvider extends ContentProvider { try { SELinux.restorecon(mDownloadsDataDir.getCanonicalPath()); } catch (IOException e) { - Slog.wtf(Constants.TAG, "Could not get canonical path for download directory", e); + Log.wtf(Constants.TAG, "Could not get canonical path for download directory", e); } return true; } @@ -503,7 +503,7 @@ public final class DownloadProvider extends ContentProvider { } default: { if (Constants.LOGV) { - Slog.v(Constants.TAG, "calling getType on an unknown URI: " + uri); + Log.v(Constants.TAG, "calling getType on an unknown URI: " + uri); } throw new IllegalArgumentException("Unknown URI: " + uri); } @@ -521,7 +521,7 @@ public final class DownloadProvider extends ContentProvider { // note we disallow inserting into ALL_DOWNLOADS int match = sURIMatcher.match(uri); if (match != MY_DOWNLOADS) { - Slog.d(Constants.TAG, "calling insert on an unknown/invalid URI: " + uri); + Log.d(Constants.TAG, "calling insert on an unknown/invalid URI: " + uri); throw new IllegalArgumentException("Unknown/Invalid URI " + uri); } @@ -668,17 +668,17 @@ public final class DownloadProvider extends ContentProvider { } if (Constants.LOGVV) { - Slog.v(Constants.TAG, "initiating download with UID " + Log.v(Constants.TAG, "initiating download with UID " + filteredValues.getAsInteger(Constants.UID)); if (filteredValues.containsKey(Downloads.Impl.COLUMN_OTHER_UID)) { - Slog.v(Constants.TAG, "other UID " + + Log.v(Constants.TAG, "other UID " + filteredValues.getAsInteger(Downloads.Impl.COLUMN_OTHER_UID)); } } long rowID = db.insert(DB_TABLE, null, filteredValues); if (rowID == -1) { - Slog.d(Constants.TAG, "couldn't insert into downloads database"); + Log.d(Constants.TAG, "couldn't insert into downloads database"); return null; } @@ -844,7 +844,7 @@ public final class DownloadProvider extends ContentProvider { int match = sURIMatcher.match(uri); if (match == -1) { if (Constants.LOGV) { - Slog.v(Constants.TAG, "querying unknown URI: " + uri); + Log.v(Constants.TAG, "querying unknown URI: " + uri); } throw new IllegalArgumentException("Unknown URI: " + uri); } @@ -891,12 +891,12 @@ public final class DownloadProvider extends ContentProvider { if (ret != null) { ret.setNotificationUri(getContext().getContentResolver(), uri); if (Constants.LOGVV) { - Slog.v(Constants.TAG, + Log.v(Constants.TAG, "created cursor " + ret + " on behalf of " + Binder.getCallingPid()); } } else { if (Constants.LOGV) { - Slog.v(Constants.TAG, "query failed in downloads database"); + Log.v(Constants.TAG, "query failed in downloads database"); } } @@ -943,7 +943,7 @@ public final class DownloadProvider extends ContentProvider { sb.append("sort is "); sb.append(sort); sb.append("."); - Slog.v(Constants.TAG, sb.toString()); + Log.v(Constants.TAG, sb.toString()); } private String getDownloadIdFromUri(final Uri uri) { @@ -1084,7 +1084,7 @@ public final class DownloadProvider extends ContentProvider { break; default: - Slog.d(Constants.TAG, "updating unknown/invalid URI: " + uri); + Log.d(Constants.TAG, "updating unknown/invalid URI: " + uri); throw new UnsupportedOperationException("Cannot update URI: " + uri); } @@ -1168,7 +1168,7 @@ public final class DownloadProvider extends ContentProvider { break; default: - Slog.d(Constants.TAG, "deleting unknown/invalid URI: " + uri); + Log.d(Constants.TAG, "deleting unknown/invalid URI: " + uri); throw new UnsupportedOperationException("Cannot delete URI: " + uri); } notifyContentChanged(uri, match); @@ -1268,33 +1268,33 @@ public final class DownloadProvider extends ContentProvider { } private void logVerboseOpenFileInfo(Uri uri, String mode) { - Slog.v(Constants.TAG, "openFile uri: " + uri + ", mode: " + mode + Log.v(Constants.TAG, "openFile uri: " + uri + ", mode: " + mode + ", uid: " + Binder.getCallingUid()); Cursor cursor = query(Downloads.Impl.CONTENT_URI, new String[] { "_id" }, null, null, "_id"); if (cursor == null) { - Slog.v(Constants.TAG, "null cursor in openFile"); + Log.v(Constants.TAG, "null cursor in openFile"); } else { if (!cursor.moveToFirst()) { - Slog.v(Constants.TAG, "empty cursor in openFile"); + Log.v(Constants.TAG, "empty cursor in openFile"); } else { do { - Slog.v(Constants.TAG, "row " + cursor.getInt(0) + " available"); + Log.v(Constants.TAG, "row " + cursor.getInt(0) + " available"); } while(cursor.moveToNext()); } cursor.close(); } cursor = query(uri, new String[] { "_data" }, null, null, null); if (cursor == null) { - Slog.v(Constants.TAG, "null cursor in openFile"); + Log.v(Constants.TAG, "null cursor in openFile"); } else { if (!cursor.moveToFirst()) { - Slog.v(Constants.TAG, "empty cursor in openFile"); + Log.v(Constants.TAG, "empty cursor in openFile"); } else { String filename = cursor.getString(0); - Slog.v(Constants.TAG, "filename in openFile: " + filename); + Log.v(Constants.TAG, "filename in openFile: " + filename); if (new java.io.File(filename).isFile()) { - Slog.v(Constants.TAG, "file exists in openFile"); + Log.v(Constants.TAG, "file exists in openFile"); } } cursor.close(); diff --git a/src/com/android/providers/downloads/DownloadReceiver.java b/src/com/android/providers/downloads/DownloadReceiver.java index 85ada1ee..f3d23766 100644 --- a/src/com/android/providers/downloads/DownloadReceiver.java +++ b/src/com/android/providers/downloads/DownloadReceiver.java @@ -33,7 +33,7 @@ import android.os.Handler; import android.os.HandlerThread; import android.provider.Downloads; import android.text.TextUtils; -import android.util.Slog; +import android.util.Log; import android.widget.Toast; import com.google.common.annotations.VisibleForTesting; @@ -64,13 +64,13 @@ public class DownloadReceiver extends BroadcastReceiver { String action = intent.getAction(); if (action.equals(Intent.ACTION_BOOT_COMPLETED)) { if (Constants.LOGVV) { - Slog.v(Constants.TAG, "Received broadcast intent for " + + Log.v(Constants.TAG, "Received broadcast intent for " + Intent.ACTION_BOOT_COMPLETED); } startService(context); } else if (action.equals(Intent.ACTION_MEDIA_MOUNTED)) { if (Constants.LOGVV) { - Slog.v(Constants.TAG, "Received broadcast intent for " + + Log.v(Constants.TAG, "Received broadcast intent for " + Intent.ACTION_MEDIA_MOUNTED); } startService(context); @@ -139,7 +139,7 @@ public class DownloadReceiver extends BroadcastReceiver { status = getInt(cursor, Downloads.Impl.COLUMN_STATUS); visibility = getInt(cursor, Downloads.Impl.COLUMN_VISIBILITY); } else { - Slog.w(TAG, "Missing details for download " + id); + Log.w(TAG, "Missing details for download " + id); return; } } finally { @@ -184,7 +184,7 @@ public class DownloadReceiver extends BroadcastReceiver { clazz = getString(cursor, Downloads.Impl.COLUMN_NOTIFICATION_CLASS); isPublicApi = getInt(cursor, Downloads.Impl.COLUMN_IS_PUBLIC_API) != 0; } else { - Slog.w(TAG, "Missing details for download " + ids[0]); + Log.w(TAG, "Missing details for download " + ids[0]); return; } } finally { @@ -192,7 +192,7 @@ public class DownloadReceiver extends BroadcastReceiver { } if (TextUtils.isEmpty(packageName)) { - Slog.w(TAG, "Missing package; skipping broadcast"); + Log.w(TAG, "Missing package; skipping broadcast"); return; } @@ -204,7 +204,7 @@ public class DownloadReceiver extends BroadcastReceiver { } else { // legacy behavior if (TextUtils.isEmpty(clazz)) { - Slog.w(TAG, "Missing class; skipping broadcast"); + Log.w(TAG, "Missing class; skipping broadcast"); return; } diff --git a/src/com/android/providers/downloads/DownloadScanner.java b/src/com/android/providers/downloads/DownloadScanner.java index 463eafab..ca795062 100644 --- a/src/com/android/providers/downloads/DownloadScanner.java +++ b/src/com/android/providers/downloads/DownloadScanner.java @@ -29,7 +29,7 @@ import android.media.MediaScannerConnection.MediaScannerConnectionClient; import android.net.Uri; import android.os.SystemClock; import android.provider.Downloads; -import android.util.Slog; +import android.util.Log; import com.android.internal.annotations.GuardedBy; import com.google.common.collect.Maps; @@ -99,7 +99,7 @@ public class DownloadScanner implements MediaScannerConnectionClient { * @see #hasPendingScans() */ public void requestScan(DownloadInfo info) { - if (LOGV) Slog.v(TAG, "requestScan() for " + info.mFileName); + if (LOGV) Log.v(TAG, "requestScan() for " + info.mFileName); synchronized (mConnection) { final ScanRequest req = new ScanRequest(info.mId, info.mFileName, info.mMimeType); mPending.put(req.path, req); @@ -132,7 +132,7 @@ public class DownloadScanner implements MediaScannerConnectionClient { req = mPending.remove(path); } if (req == null) { - Slog.w(TAG, "Missing request for path " + path); + Log.w(TAG, "Missing request for path " + path); return; } diff --git a/src/com/android/providers/downloads/DownloadService.java b/src/com/android/providers/downloads/DownloadService.java index 5d9647d4..7d746cca 100644 --- a/src/com/android/providers/downloads/DownloadService.java +++ b/src/com/android/providers/downloads/DownloadService.java @@ -37,7 +37,7 @@ import android.os.Message; import android.os.Process; import android.provider.Downloads; import android.text.TextUtils; -import android.util.Slog; +import android.util.Log; import com.android.internal.annotations.GuardedBy; import com.android.internal.util.IndentingPrintWriter; @@ -149,7 +149,7 @@ public class DownloadService extends Service { public void onCreate() { super.onCreate(); if (Constants.LOGVV) { - Slog.v(Constants.TAG, "Service onCreate"); + Log.v(Constants.TAG, "Service onCreate"); } if (mSystemFacade == null) { @@ -177,7 +177,7 @@ public class DownloadService extends Service { public int onStartCommand(Intent intent, int flags, int startId) { int returnValue = super.onStartCommand(intent, flags, startId); if (Constants.LOGVV) { - Slog.v(Constants.TAG, "Service onStart"); + Log.v(Constants.TAG, "Service onStart"); } mLastStartId = startId; enqueueUpdate(); @@ -190,7 +190,7 @@ public class DownloadService extends Service { mScanner.shutdown(); mUpdateThread.quit(); if (Constants.LOGVV) { - Slog.v(Constants.TAG, "Service onDestroy"); + Log.v(Constants.TAG, "Service onDestroy"); } super.onDestroy(); } @@ -223,7 +223,7 @@ public class DownloadService extends Service { Process.setThreadPriority(Process.THREAD_PRIORITY_BACKGROUND); final int startId = msg.arg1; - if (DEBUG_LIFECYCLE) Slog.v(TAG, "Updating for startId " + startId); + if (DEBUG_LIFECYCLE) Log.v(TAG, "Updating for startId " + startId); // Since database is current source of truth, our "active" status // depends on database state. We always get one final update pass @@ -242,14 +242,14 @@ public class DownloadService extends Service { for (Map.Entry entry : Thread.getAllStackTraces().entrySet()) { if (entry.getKey().getName().startsWith("pool")) { - Slog.d(TAG, entry.getKey() + ": " + Arrays.toString(entry.getValue())); + Log.d(TAG, entry.getKey() + ": " + Arrays.toString(entry.getValue())); } } // Dump speed and update details mNotifier.dumpSpeeds(); - Slog.wtf(TAG, "Final update pass triggered, isActive=" + isActive + Log.wtf(TAG, "Final update pass triggered, isActive=" + isActive + "; someone didn't update correctly."); } @@ -267,7 +267,7 @@ public class DownloadService extends Service { // will always be delivered with a new startId. if (stopSelfResult(startId)) { - if (DEBUG_LIFECYCLE) Slog.v(TAG, "Nothing left; stopped"); + if (DEBUG_LIFECYCLE) Log.v(TAG, "Nothing left; stopped"); getContentResolver().unregisterContentObserver(mObserver); mScanner.shutdown(); mUpdateThread.quit(); @@ -332,7 +332,7 @@ public class DownloadService extends Service { final boolean activeScan = info.startScanIfReady(mScanner); if (DEBUG_LIFECYCLE && (activeDownload || activeScan)) { - Slog.v(TAG, "Download " + info.mId + ": activeDownload=" + activeDownload + Log.v(TAG, "Download " + info.mId + ": activeDownload=" + activeDownload + ", activeScan=" + activeScan); } @@ -359,7 +359,7 @@ public class DownloadService extends Service { // continues to run in meantime, since it will kick off an update pass. if (nextActionMillis > 0 && nextActionMillis < Long.MAX_VALUE) { if (Constants.LOGV) { - Slog.v(TAG, "scheduling start in " + nextActionMillis + "ms"); + Log.v(TAG, "scheduling start in " + nextActionMillis + "ms"); } final Intent intent = new Intent(Constants.ACTION_RETRY); @@ -381,7 +381,7 @@ public class DownloadService extends Service { mDownloads.put(info.mId, info); if (Constants.LOGVV) { - Slog.v(Constants.TAG, "processing inserted download " + info.mId); + Log.v(Constants.TAG, "processing inserted download " + info.mId); } return info; @@ -393,7 +393,7 @@ public class DownloadService extends Service { private void updateDownload(DownloadInfo.Reader reader, DownloadInfo info, long now) { reader.updateFromDatabase(info); if (Constants.LOGVV) { - Slog.v(Constants.TAG, "processing updated download " + info.mId + + Log.v(Constants.TAG, "processing updated download " + info.mId + ", status: " + info.mStatus); } } @@ -408,7 +408,7 @@ public class DownloadService extends Service { } if (info.mDestination != Downloads.Impl.DESTINATION_EXTERNAL && info.mFileName != null) { if (Constants.LOGVV) { - Slog.d(TAG, "deleteDownloadLocked() deleting " + info.mFileName); + Log.d(TAG, "deleteDownloadLocked() deleting " + info.mFileName); } deleteFileIfExists(info.mFileName); } @@ -418,11 +418,11 @@ public class DownloadService extends Service { private void deleteFileIfExists(String path) { if (!TextUtils.isEmpty(path)) { if (Constants.LOGVV) { - Slog.d(TAG, "deleteFileIfExists() deleting " + path); + Log.d(TAG, "deleteFileIfExists() deleting " + path); } final File file = new File(path); if (file.exists() && !file.delete()) { - Slog.w(TAG, "file: '" + path + "' couldn't be deleted"); + Log.w(TAG, "file: '" + path + "' couldn't be deleted"); } } } diff --git a/src/com/android/providers/downloads/DownloadThread.java b/src/com/android/providers/downloads/DownloadThread.java index 3e1cce67..93f8d650 100644 --- a/src/com/android/providers/downloads/DownloadThread.java +++ b/src/com/android/providers/downloads/DownloadThread.java @@ -51,7 +51,7 @@ import android.os.SystemClock; import android.os.WorkSource; import android.provider.Downloads; import android.text.TextUtils; -import android.util.Slog; +import android.util.Log; import android.util.Pair; import com.android.providers.downloads.DownloadInfo.NetworkState; @@ -175,7 +175,7 @@ public class DownloadThread implements Runnable { // probably started again while racing with UpdateThread. if (DownloadInfo.queryDownloadStatus(mContext.getContentResolver(), mInfo.mId) == Downloads.Impl.STATUS_SUCCESS) { - Slog.d(TAG, "Download " + mInfo.mId + " already finished; skipping"); + Log.d(TAG, "Download " + mInfo.mId + " already finished; skipping"); return; } @@ -196,7 +196,7 @@ public class DownloadThread implements Runnable { // while performing download, register for rules updates netPolicy.registerListener(mPolicyListener); - Slog.i(Constants.TAG, "Download " + mInfo.mId + " starting (" + mInfo.mUri + ")"); + Log.i(Constants.TAG, "Download " + mInfo.mId + " starting"); // Remember which network this download started on; used to // determine if errors were due to network changes. @@ -225,9 +225,9 @@ public class DownloadThread implements Runnable { // remove the cause before printing, in case it contains PII errorMsg = error.getMessage(); String msg = "Aborting request for download " + mInfo.mId + ": " + errorMsg; - Slog.w(Constants.TAG, msg); + Log.w(Constants.TAG, msg); if (Constants.LOGV) { - Slog.w(Constants.TAG, msg, error); + Log.w(Constants.TAG, msg, error); } finalStatus = error.getFinalStatus(); @@ -262,7 +262,7 @@ public class DownloadThread implements Runnable { } catch (Throwable ex) { errorMsg = ex.getMessage(); String msg = "Exception for id " + mInfo.mId + ": " + errorMsg; - Slog.w(Constants.TAG, msg, ex); + Log.w(Constants.TAG, msg, ex); finalStatus = Downloads.Impl.STATUS_UNKNOWN_ERROR; // falls through to the code that reports an error } finally { @@ -276,7 +276,7 @@ public class DownloadThread implements Runnable { cleanupDestination(state, finalStatus); notifyDownloadCompleted(state, finalStatus, errorMsg, numFailed); - Slog.i(Constants.TAG, "Download " + mInfo.mId + " finished with status " + Log.i(Constants.TAG, "Download " + mInfo.mId + " finished with status " + Downloads.Impl.statusToString(finalStatus)); netPolicy.unregisterListener(mPolicyListener); @@ -299,7 +299,7 @@ public class DownloadThread implements Runnable { // skip when already finished; remove after fixing race in 5217390 if (state.mCurrentBytes == state.mTotalBytes) { - Slog.i(Constants.TAG, "Skipping initiating request for download " + + Log.i(Constants.TAG, "Skipping initiating request for download " + mInfo.mId + "; already completed"); return; } @@ -477,7 +477,7 @@ public class DownloadThread implements Runnable { reportProgress(state); if (Constants.LOGVV) { - Slog.v(Constants.TAG, "downloaded " + state.mCurrentBytes + " for " + Log.v(Constants.TAG, "downloaded " + state.mCurrentBytes + " for " + mInfo.mUri); } @@ -502,7 +502,7 @@ public class DownloadThread implements Runnable { private void cleanupDestination(State state, int finalStatus) { if (state.mFilename != null && Downloads.Impl.isStatusError(finalStatus)) { if (Constants.LOGVV) { - Slog.d(TAG, "cleanupDestination() deleting " + state.mFilename); + Log.d(TAG, "cleanupDestination() deleting " + state.mFilename); } new File(state.mFilename).delete(); state.mFilename = null; @@ -715,7 +715,7 @@ public class DownloadThread implements Runnable { if (transferEncoding == null) { state.mContentLength = getHeaderFieldLong(conn, "Content-Length", -1); } else { - Slog.i(TAG, "Ignoring Content-Length since Transfer-Encoding is also defined"); + Log.i(TAG, "Ignoring Content-Length since Transfer-Encoding is also defined"); state.mContentLength = -1; } @@ -752,7 +752,7 @@ public class DownloadThread implements Runnable { private void setupDestinationFile(State state) throws StopRequestException { if (!TextUtils.isEmpty(state.mFilename)) { // only true if we've already run a thread for this download if (Constants.LOGV) { - Slog.i(Constants.TAG, "have run thread before for id: " + mInfo.mId + + Log.i(Constants.TAG, "have run thread before for id: " + mInfo.mId + ", and state.mFilename: " + state.mFilename); } if (!Helpers.isFilenameValid(state.mFilename, @@ -765,26 +765,26 @@ public class DownloadThread implements Runnable { File f = new File(state.mFilename); if (f.exists()) { if (Constants.LOGV) { - Slog.i(Constants.TAG, "resuming download for id: " + mInfo.mId + + Log.i(Constants.TAG, "resuming download for id: " + mInfo.mId + ", and state.mFilename: " + state.mFilename); } long fileLength = f.length(); if (fileLength == 0) { // The download hadn't actually started, we can restart from scratch if (Constants.LOGVV) { - Slog.d(TAG, "setupDestinationFile() found fileLength=0, deleting " + Log.d(TAG, "setupDestinationFile() found fileLength=0, deleting " + state.mFilename); } f.delete(); state.mFilename = null; if (Constants.LOGV) { - Slog.i(Constants.TAG, "resuming download for id: " + mInfo.mId + + Log.i(Constants.TAG, "resuming download for id: " + mInfo.mId + ", BUT starting from scratch again: "); } } else if (mInfo.mETag == null && !mInfo.mNoIntegrity) { // This should've been caught upon failure if (Constants.LOGVV) { - Slog.d(TAG, "setupDestinationFile() unable to resume download, deleting " + Log.d(TAG, "setupDestinationFile() unable to resume download, deleting " + state.mFilename); } f.delete(); @@ -793,7 +793,7 @@ public class DownloadThread implements Runnable { } else { // All right, we'll be able to resume this download if (Constants.LOGV) { - Slog.i(Constants.TAG, "resuming download for id: " + mInfo.mId + + Log.i(Constants.TAG, "resuming download for id: " + mInfo.mId + ", and starting with file of length: " + fileLength); } state.mCurrentBytes = (int) fileLength; @@ -803,7 +803,7 @@ public class DownloadThread implements Runnable { state.mHeaderETag = mInfo.mETag; state.mContinuingDownload = true; if (Constants.LOGV) { - Slog.i(Constants.TAG, "resuming download for id: " + mInfo.mId + + Log.i(Constants.TAG, "resuming download for id: " + mInfo.mId + ", state.mCurrentBytes: " + state.mCurrentBytes + ", and setting mContinuingDownload to true: "); } diff --git a/src/com/android/providers/downloads/StorageManager.java b/src/com/android/providers/downloads/StorageManager.java index df5312a9..deb412e7 100644 --- a/src/com/android/providers/downloads/StorageManager.java +++ b/src/com/android/providers/downloads/StorageManager.java @@ -29,7 +29,7 @@ import android.os.Environment; import android.os.StatFs; import android.provider.Downloads; import android.text.TextUtils; -import android.util.Slog; +import android.util.Log; import com.android.internal.R; @@ -130,7 +130,7 @@ class StorageManager { resetBytesDownloadedSinceLastCheckOnSpace(); File dir = null; if (Constants.LOGV) { - Slog.i(Constants.TAG, "in verifySpace, destination: " + destination + + Log.i(Constants.TAG, "in verifySpace, destination: " + destination + ", path: " + path + ", length: " + length); } if (path == null) { @@ -202,7 +202,7 @@ class StorageManager { * few MB of space left on the filesystem. */ if (root.equals(mSystemCacheDir)) { - Slog.w(Constants.TAG, "System cache dir ('/cache') is running low on space." + + Log.w(Constants.TAG, "System cache dir ('/cache') is running low on space." + "space available (in bytes): " + bytesAvailable); } else { throw new StopRequestException(Downloads.Impl.STATUS_INSUFFICIENT_SPACE_ERROR, @@ -216,7 +216,7 @@ class StorageManager { bytesAvailable = getAvailableBytesInDownloadsDataDir(mDownloadDataDir); if (bytesAvailable < sDownloadDataDirLowSpaceThreshold) { // print a warning - Slog.w(Constants.TAG, "Downloads data dir: " + root + + Log.w(Constants.TAG, "Downloads data dir: " + root + " is running low on space. space available (in bytes): " + bytesAvailable); } if (bytesAvailable < targetBytes) { @@ -248,7 +248,7 @@ class StorageManager { space -= files[i].length(); } if (Constants.LOGV) { - Slog.i(Constants.TAG, "available space (in bytes) in downloads data dir: " + space); + Log.i(Constants.TAG, "available space (in bytes) in downloads data dir: " + space); } return space; } @@ -259,7 +259,7 @@ class StorageManager { long availableBlocks = (long) stat.getAvailableBlocks() - 4; long size = stat.getBlockSize() * availableBlocks; if (Constants.LOGV) { - Slog.i(Constants.TAG, "available space (in bytes) in filesystem rooted at: " + + Log.i(Constants.TAG, "available space (in bytes) in filesystem rooted at: " + root.getPath() + " is: " + size); } return size; @@ -303,7 +303,7 @@ class StorageManager { */ private long discardPurgeableFiles(int destination, long targetBytes) { if (true || Constants.LOGV) { - Slog.i(Constants.TAG, "discardPurgeableFiles: destination = " + destination + + Log.i(Constants.TAG, "discardPurgeableFiles: destination = " + destination + ", targetBytes = " + targetBytes); } String destStr = (destination == Downloads.Impl.DESTINATION_SYSTEMCACHE_PARTITION) ? @@ -330,7 +330,7 @@ class StorageManager { File file = new File(data); if (Constants.LOGV) { - Slog.d(Constants.TAG, "purging " + file.getAbsolutePath() + " for " + Log.d(Constants.TAG, "purging " + file.getAbsolutePath() + " for " + file.length() + " bytes"); } totalFreed += file.length(); @@ -344,7 +344,7 @@ class StorageManager { cursor.close(); } if (true || Constants.LOGV) { - Slog.i(Constants.TAG, "Purged files, freed " + totalFreed + " for " + + Log.i(Constants.TAG, "Purged files, freed " + totalFreed + " for " + targetBytes + " requested"); } return totalFreed; @@ -359,7 +359,7 @@ class StorageManager { */ private void removeSpuriousFiles() { if (Constants.LOGV) { - Slog.i(Constants.TAG, "in removeSpuriousFiles"); + Log.i(Constants.TAG, "in removeSpuriousFiles"); } // get a list of all files in system cache dir and downloads data dir List files = new ArrayList(); @@ -383,7 +383,7 @@ class StorageManager { String filename = cursor.getString(0); if (!TextUtils.isEmpty(filename)) { if (LOGV) { - Slog.i(Constants.TAG, "in removeSpuriousFiles, preserving file " + + Log.i(Constants.TAG, "in removeSpuriousFiles, preserving file " + filename); } files.remove(new File(filename)); @@ -404,12 +404,12 @@ class StorageManager { final StructStat stat = Libcore.os.stat(path); if (stat.st_uid == myUid) { if (Constants.LOGVV) { - Slog.d(TAG, "deleting spurious file " + path); + Log.d(TAG, "deleting spurious file " + path); } file.delete(); } } catch (ErrnoException e) { - Slog.w(TAG, "stat(" + path + ") result: " + e); + Log.w(TAG, "stat(" + path + ") result: " + e); } } } @@ -421,7 +421,7 @@ class StorageManager { */ private void trimDatabase() { if (Constants.LOGV) { - Slog.i(Constants.TAG, "in trimDatabase"); + Log.i(Constants.TAG, "in trimDatabase"); } Cursor cursor = null; try { @@ -432,7 +432,7 @@ class StorageManager { if (cursor == null) { // This isn't good - if we can't do basic queries in our database, // nothing's gonna work - Slog.e(Constants.TAG, "null cursor in trimDatabase"); + Log.e(Constants.TAG, "null cursor in trimDatabase"); return; } if (cursor.moveToFirst()) { @@ -452,7 +452,7 @@ class StorageManager { // trimming the database raised an exception. alright, ignore the exception // and return silently. trimming database is not exactly a critical operation // and there is no need to propagate the exception. - Slog.w(Constants.TAG, "trimDatabase failed with exception: " + e.getMessage()); + Log.w(Constants.TAG, "trimDatabase failed with exception: " + e.getMessage()); return; } finally { if (cursor != null) { -- cgit v1.2.3