summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNandana Dutt <nandana@google.com>2019-06-14 14:26:10 +0100
committerNandana Dutt <nandana@google.com>2019-08-01 16:08:56 +0100
commit56659ae22f0a2fb22bc83af92fa82f95e05a0586 (patch)
tree181c285a5f797f3317675d20b35fc5faf80fef24
parent9f3eb4a13036ced857994c3ae18e84e77df605fa (diff)
Remove obsolete methods from DumpstateListener implementations
Note that with the new Bugreporting API, SystemServer is the only expected DumpstateListener implementation. Once we fully migrate Shell app, we can remove the implementation in BugreportService as well. BUG: 128980174 Test: bugreport from power menu, observe progress bar Change-Id: I40d654a70bd9ceb3a29f8a0113b85616100f4ee9
-rw-r--r--core/java/android/os/BugreportManager.java17
-rw-r--r--packages/Shell/src/com/android/shell/BugreportProgressService.java52
-rw-r--r--services/core/java/com/android/server/os/BugreportManagerServiceImpl.java14
3 files changed, 7 insertions, 76 deletions
diff --git a/core/java/android/os/BugreportManager.java b/core/java/android/os/BugreportManager.java
index 3cdebac413f9..c5cbad33c06c 100644
--- a/core/java/android/os/BugreportManager.java
+++ b/core/java/android/os/BugreportManager.java
@@ -235,22 +235,5 @@ public final class BugreportManager {
Binder.restoreCallingIdentity(identity);
}
}
-
- // Old methods; should go away
- @Override
- public void onProgressUpdated(int progress) throws RemoteException {
- // TODO(b/111441001): remove from interface
- }
-
- @Override
- public void onMaxProgressUpdated(int maxProgress) throws RemoteException {
- // TODO(b/111441001): remove from interface
- }
-
- @Override
- public void onSectionComplete(String title, int status, int size, int durationMs)
- throws RemoteException {
- // TODO(b/111441001): remove from interface
- }
}
}
diff --git a/packages/Shell/src/com/android/shell/BugreportProgressService.java b/packages/Shell/src/com/android/shell/BugreportProgressService.java
index 2727880685c5..279cf3033238 100644
--- a/packages/Shell/src/com/android/shell/BugreportProgressService.java
+++ b/packages/Shell/src/com/android/shell/BugreportProgressService.java
@@ -199,9 +199,9 @@ public class BugreportProgressService extends Service {
// Passed to Message.obtain() when msg.arg2 is not used.
private static final int UNUSED_ARG2 = -2;
- // Maximum progress displayed (like 99.00%).
- private static final int CAPPED_PROGRESS = 9900;
- private static final int CAPPED_MAX = 10000;
+ // Maximum progress displayed in %.
+ private static final int CAPPED_PROGRESS = 99;
+ private static final int CAPPED_MAX = 100;
/** Show the progress log every this percent. */
private static final int LOG_PROGRESS_STEP = 10;
@@ -2164,8 +2164,7 @@ public class BugreportProgressService extends Service {
@Override
public void onProgress(int progress) throws RemoteException {
- updateProgressInfo(info, progress, 100 /* progress is already a percentage;
- so max = 100 */);
+ checkProgressUpdated(info, progress);
}
@Override
@@ -2178,26 +2177,6 @@ public class BugreportProgressService extends Service {
// TODO(b/111441001): implement
}
- @Override
- public void onProgressUpdated(int progress) throws RemoteException {
- checkProgressUpdated(info, progress);
- }
-
- @Override
- public void onMaxProgressUpdated(int maxProgress) throws RemoteException {
- Log.d(TAG, "onMaxProgressUpdated: " + maxProgress);
- info.realMax = maxProgress;
- }
-
- @Override
- public void onSectionComplete(String title, int status, int size, int durationMs)
- throws RemoteException {
- if (DEBUG) {
- Log.v(TAG, "Title: " + title + " Status: " + status + " Size: " + size
- + " Duration: " + durationMs + "ms");
- }
- }
-
public void dump(String prefix, PrintWriter pw) {
pw.print(prefix); pw.print("token: "); pw.println(token);
}
@@ -2205,27 +2184,10 @@ public class BugreportProgressService extends Service {
}
private void checkProgressUpdated(BugreportInfo info, int progress) {
- /*
- * Checks whether the progress changed in a way that should be displayed to the user:
- * - info.progress / info.max represents the displayed progress
- * - info.realProgress / info.realMax represents the real progress
- * - since the real progress can decrease, the displayed progress is only updated if it
- * increases
- * - the displayed progress is capped at a maximum (like 99%)
- */
- info.realProgress = progress;
- final int oldPercentage = (CAPPED_MAX * info.progress) / info.max;
- int newPercentage = (CAPPED_MAX * info.realProgress) / info.realMax;
- int max = info.realMax;
-
- if (newPercentage > CAPPED_PROGRESS) {
- progress = newPercentage = CAPPED_PROGRESS;
- max = CAPPED_MAX;
- }
-
- if (progress == 0 || newPercentage > oldPercentage) {
- updateProgressInfo(info, progress, max);
+ if (progress > CAPPED_PROGRESS) {
+ progress = CAPPED_PROGRESS;
}
+ updateProgressInfo(info, progress, CAPPED_MAX);
}
private void updateProgressInfo(BugreportInfo info, int progress, int max) {
diff --git a/services/core/java/com/android/server/os/BugreportManagerServiceImpl.java b/services/core/java/com/android/server/os/BugreportManagerServiceImpl.java
index c98a79ad4ed9..714bbb97c90d 100644
--- a/services/core/java/com/android/server/os/BugreportManagerServiceImpl.java
+++ b/services/core/java/com/android/server/os/BugreportManagerServiceImpl.java
@@ -297,19 +297,5 @@ class BugreportManagerServiceImpl extends IDumpstate.Stub {
}
mDs.asBinder().unlinkToDeath(this, 0);
}
-
- // Old methods; unused in the API flow.
- @Override
- public void onProgressUpdated(int progress) throws RemoteException {
- }
-
- @Override
- public void onMaxProgressUpdated(int maxProgress) throws RemoteException {
- }
-
- @Override
- public void onSectionComplete(String title, int status, int size, int durationMs)
- throws RemoteException {
- }
}
}