Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 82446aa5 authored by Nandana Dutt's avatar Nandana Dutt Committed by android-build-merger
Browse files

Merge "Remove obsolete methods from DumpstateListener implementations" am: cbdb10f9

am: b745860a

Change-Id: Idd72ca09a0256c3e1283fd0c9d73a29939de4778
parents 10bba25e b745860a
Loading
Loading
Loading
Loading
+0 −17
Original line number Diff line number Diff line
@@ -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
        }
    }
}
+7 −44
Original line number Diff line number Diff line
@@ -176,9 +176,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;
@@ -1957,7 +1957,10 @@ public class BugreportProgressService extends Service {

        @Override
        public void onProgress(int progress) throws RemoteException {
            updateProgressInfo(progress, 100 /* progress is already a percentage; so max = 100 */);
            if (progress > CAPPED_PROGRESS) {
                progress = CAPPED_PROGRESS;
            }
            updateProgressInfo(progress, CAPPED_MAX);
        }

        @Override
@@ -1970,46 +1973,6 @@ public class BugreportProgressService extends Service {
            // TODO(b/111441001): implement
        }

        @Override
        public void onProgressUpdated(int progress) throws RemoteException {
            /*
             * 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 (newPercentage > oldPercentage) {
                updateProgressInfo(progress, max);
            }
        }

        @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);
        }
+0 −14
Original line number Diff line number Diff line
@@ -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 {
        }
    }
}