summaryrefslogtreecommitdiff
path: root/packages/Shell/src
diff options
context:
space:
mode:
authorFelipe Leme <felipeal@google.com>2016-01-29 18:01:49 -0800
committerFelipe Leme <felipeal@google.com>2016-02-01 09:26:52 -0800
commitaf6fd4086c8f24e8b70a810fe83081b67e5db236 (patch)
tree0f6ee1379603f114f3f65b5aa0ab60af73d3ca45 /packages/Shell/src
parentb0f83b50adf5a59a4e8ad725a3f13ae815b11e6b (diff)
Added extra sanity checks.
BUG: 26795255 BUG: 26805503 Change-Id: Ib95b337e54a174f178f70205f9d108223f192a62
Diffstat (limited to 'packages/Shell/src')
-rw-r--r--packages/Shell/src/com/android/shell/BugreportProgressService.java21
1 files changed, 17 insertions, 4 deletions
diff --git a/packages/Shell/src/com/android/shell/BugreportProgressService.java b/packages/Shell/src/com/android/shell/BugreportProgressService.java
index a93caca735a2..78197b35f613 100644
--- a/packages/Shell/src/com/android/shell/BugreportProgressService.java
+++ b/packages/Shell/src/com/android/shell/BugreportProgressService.java
@@ -286,7 +286,7 @@ public class BugreportProgressService extends Service {
// At this point it's handling onStartCommand(), with the intent passed as an Extra.
if (!(msg.obj instanceof Intent)) {
// Sanity check.
- Log.e(TAG, "Internal error: invalid msg.obj: " + msg.obj);
+ Log.wtf(TAG, "handleMessage(): invalid msg.obj type: " + msg.obj);
return;
}
final Parcelable parcel = ((Intent) msg.obj).getParcelableExtra(EXTRA_ORIGINAL_INTENT);
@@ -520,8 +520,14 @@ public class BugreportProgressService extends Service {
}
int activeProcesses = 0;
for (int i = 0; i < total; i++) {
- final int pid = mProcesses.keyAt(i);
final BugreportInfo info = mProcesses.valueAt(i);
+ if (info == null) {
+ Log.wtf(TAG, "pollProgress(): null info at index " + i + "(pid = "
+ + mProcesses.keyAt(i) + ")");
+ continue;
+ }
+
+ final int pid = info.pid;
if (info.finished) {
if (DEBUG) Log.v(TAG, "Skipping finished process " + pid);
continue;
@@ -720,6 +726,12 @@ public class BugreportProgressService extends Service {
* Handles the BUGREPORT_FINISHED intent sent by {@code dumpstate}.
*/
private void onBugreportFinished(int pid, Intent intent) {
+ final File bugreportFile = getFileExtra(intent, EXTRA_BUGREPORT);
+ if (bugreportFile == null) {
+ // Should never happen, dumpstate always set the file.
+ Log.wtf(TAG, "Missing " + EXTRA_BUGREPORT + " on intent " + intent);
+ return;
+ }
mInfoDialog.onBugreportFinished(pid);
BugreportInfo info = getInfo(pid);
if (info == null) {
@@ -729,7 +741,8 @@ public class BugreportProgressService extends Service {
mProcesses.put(pid, info);
}
info.renameScreenshots(mScreenshotsDir);
- info.bugreportFile = getFileExtra(intent, EXTRA_BUGREPORT);
+ info.bugreportFile = bugreportFile;
+
final File screenshot = getFileExtra(intent, EXTRA_SCREENSHOT);
if (screenshot != null) {
info.addScreenshot(screenshot);
@@ -957,7 +970,7 @@ public class BugreportProgressService extends Service {
private static void addDetailsToZipFile(Context context, BugreportInfo info) {
if (info.bugreportFile == null) {
// One possible reason is a bug in the Parcelization code.
- Log.e(TAG, "INTERNAL ERROR: no bugreportFile on " + info);
+ Log.wtf(TAG, "addDetailsToZipFile(): no bugreportFile on " + info);
return;
}
if (TextUtils.isEmpty(info.title) && TextUtils.isEmpty(info.description)) {