summaryrefslogtreecommitdiff
path: root/packages/Shell/src
diff options
context:
space:
mode:
author Makoto Onuki <omakoto@google.com> 2017-04-21 09:43:16 -0700
committer Makoto Onuki <omakoto@google.com> 2017-04-21 12:01:03 -0700
commitc6cf2b807281c82d9cf7d018b703b2f21388f7a5 (patch)
treebe0e7b9aba5bf16a81c5ab5cdc8ab9d286a6c371 /packages/Shell/src
parent035aaddbb39d9978f0408b2601fa66fe57bc967d (diff)
Only show progress log every 10%
Bug: 37501913 Test: manual Change-Id: Ib7d14da0af33d39aa29b0b58c63c51e1059e0ada
Diffstat (limited to 'packages/Shell/src')
-rw-r--r--packages/Shell/src/com/android/shell/BugreportProgressService.java14
1 files changed, 13 insertions, 1 deletions
diff --git a/packages/Shell/src/com/android/shell/BugreportProgressService.java b/packages/Shell/src/com/android/shell/BugreportProgressService.java
index d37e6a0ebd78..415bf9a0470b 100644
--- a/packages/Shell/src/com/android/shell/BugreportProgressService.java
+++ b/packages/Shell/src/com/android/shell/BugreportProgressService.java
@@ -172,6 +172,9 @@ public class BugreportProgressService extends Service {
private static final int CAPPED_PROGRESS = 9900;
private static final int CAPPED_MAX = 10000;
+ /** Show the progress log every this percent. */
+ private static final int LOG_PROGRESS_STEP = 10;
+
/**
* Delay before a screenshot is taken.
* <p>
@@ -226,6 +229,8 @@ public class BugreportProgressService extends Service {
private boolean mIsWatch;
+ private int mLastProgressPercent;
+
@Override
public void onCreate() {
mContext = getApplicationContext();
@@ -512,8 +517,15 @@ public class BugreportProgressService extends Service {
builder.setContentIntent(infoPendingIntent)
.setActions(infoAction, screenshotAction, cancelAction);
}
+ // Show a debug log, every LOG_PROGRESS_STEP percent.
+ final int progress = (info.progress * 100) / info.max;
+
+ if ((info.progress == 0) || (info.progress >= 100) ||
+ ((progress / LOG_PROGRESS_STEP) != (mLastProgressPercent / LOG_PROGRESS_STEP))) {
+ Log.d(TAG, "Progress #" + info.id + ": " + percentageText);
+ }
+ mLastProgressPercent = progress;
- Log.d(TAG, "Sending 'Progress' notification for id " + info.id + ": " + percentageText);
sendForegroundabledNotification(info.id, builder.build());
}