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

Commit 27096822 authored by Alon Albert's avatar Alon Albert
Browse files

Log global autosync on dumpsys

Protect dumpsys from divide by zero

Change-Id: I3474f2f4b41643ef1e95cbcf835c96b66b13de38
parent 7a939077
Loading
Loading
Loading
Loading
+61 −55
Original line number Diff line number Diff line
@@ -1034,6 +1034,7 @@ public class SyncManager implements OnAccountsUpdateListener {

    protected void dumpSyncState(PrintWriter pw) {
        pw.print("data connected: "); pw.println(mDataConnectionIsConnected);
        pw.print("auto sync: "); pw.println(mSyncStorageEngine.getMasterSyncAutomatically());
        pw.print("memory low: "); pw.println(mStorageIsLow);

        final Account[] accounts = mAccounts;
@@ -1272,8 +1273,10 @@ public class SyncManager implements OnAccountsUpdateListener {

            }

            if (totalElapsedTime > 0) {
                pw.println();
            pw.printf("Detailed Statistics (Recent history):  %d (# of times) %ds (sync time)\n",
                pw.printf("Detailed Statistics (Recent history):  "
                        + "%d (# of times) %ds (sync time)\n",
                        totalTimes, totalElapsedTime / 1000);

                final List<AuthoritySyncStats> sortedAuthorities =
@@ -1296,8 +1299,10 @@ public class SyncManager implements OnAccountsUpdateListener {
                Arrays.fill(chars, '-');
                final String separator = new String(chars);

            final String authorityFormat = String.format("  %%-%ds: %%-9s  %%-11s\n", maxLength + 2);
            final String accountFormat = String.format("    %%-%ds:   %%-9s  %%-11s\n", maxLength);
                final String authorityFormat =
                        String.format("  %%-%ds: %%-9s  %%-11s\n", maxLength + 2);
                final String accountFormat =
                        String.format("    %%-%ds:   %%-9s  %%-11s\n", maxLength);

                pw.println(separator);
                for (AuthoritySyncStats authoritySyncStats : sortedAuthorities) {
@@ -1344,6 +1349,7 @@ public class SyncManager implements OnAccountsUpdateListener {
                    }
                    pw.println(separator);
                }
            }

            pw.println();
            pw.println("Recent Sync History");