From 4f663f6c25488a83a438a01dfef8372aa4e6b2aa Mon Sep 17 00:00:00 2001 From: Felipe Leme Date: Tue, 8 Mar 2016 11:41:18 -0800 Subject: [PATCH] Minor improvements on BugreportProgressService: - Removed unnecessary ContextWrapper used to get files dir. - Immproved logging. BUG: 27548183 BUG: 27524556 Change-Id: Ia04c6b7640969e0013ae282efbb1142fc0fc5695 --- .../src/com/android/shell/BugreportProgressService.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/Shell/src/com/android/shell/BugreportProgressService.java b/packages/Shell/src/com/android/shell/BugreportProgressService.java index 0fad11357bd9b..14a4a0e65052c 100644 --- a/packages/Shell/src/com/android/shell/BugreportProgressService.java +++ b/packages/Shell/src/com/android/shell/BugreportProgressService.java @@ -56,7 +56,6 @@ import android.app.PendingIntent; import android.app.Service; import android.content.ClipData; import android.content.Context; -import android.content.ContextWrapper; import android.content.DialogInterface; import android.content.Intent; import android.content.res.Configuration; @@ -206,7 +205,7 @@ public class BugreportProgressService extends Service { mMainHandler = new ServiceHandler("BugreportProgressServiceMainThread"); mScreenshotHandler = new ScreenshotHandler("BugreportProgressServiceScreenshotThread"); - mScreenshotsDir = new File(new ContextWrapper(mContext).getFilesDir(), SCREENSHOT_DIR); + mScreenshotsDir = new File(getFilesDir(), SCREENSHOT_DIR); if (!mScreenshotsDir.exists()) { Log.i(TAG, "Creating directory " + mScreenshotsDir + " to store temporary screenshots"); if (!mScreenshotsDir.mkdir()) { @@ -877,6 +876,8 @@ public class BugreportProgressService extends Service { info = sharedInfo; Log.d(TAG, "shareBugreport(): no info for ID " + id + " on managed processes (" + mProcesses + "), using info from intent instead (" + info + ")"); + } else { + Log.v(TAG, "shareBugReport(): id " + id + " info = " + info); } addDetailsToZipFile(mContext, info); @@ -1532,6 +1533,7 @@ public class BugreportProgressService extends Service { final File newFile; if (!newName.equals(oldName)) { final File renamedFile = new File(screenshotDir, newName); + Log.d(TAG, "Renaming screenshot file " + oldFile + " to " + renamedFile); newFile = oldFile.renameTo(renamedFile) ? renamedFile : oldFile; } else { Log.w(TAG, "Name didn't change: " + oldName); // Shouldn't happen.