diff options
Diffstat (limited to 'com/android/server/print/RemotePrintSpooler.java')
-rw-r--r-- | com/android/server/print/RemotePrintSpooler.java | 36 |
1 files changed, 11 insertions, 25 deletions
diff --git a/com/android/server/print/RemotePrintSpooler.java b/com/android/server/print/RemotePrintSpooler.java index f654fcb6..a69baa11 100644 --- a/com/android/server/print/RemotePrintSpooler.java +++ b/com/android/server/print/RemotePrintSpooler.java @@ -43,16 +43,14 @@ import android.printservice.PrintService; import android.service.print.PrintSpoolerStateProto; import android.util.Slog; import android.util.TimedRemoteCaller; -import android.util.proto.ProtoOutputStream; import com.android.internal.annotations.GuardedBy; import com.android.internal.os.TransferPipe; +import com.android.internal.print.DualDumpOutputStream; import libcore.io.IoUtils; -import java.io.FileDescriptor; import java.io.IOException; -import java.io.PrintWriter; import java.lang.ref.WeakReference; import java.util.List; import java.util.concurrent.TimeoutException; @@ -558,37 +556,25 @@ final class RemotePrintSpooler { } } - public void dump(@NonNull ProtoOutputStream proto) { + public void dump(@NonNull DualDumpOutputStream dumpStream) { synchronized (mLock) { - proto.write(PrintSpoolerStateProto.IS_DESTROYED, mDestroyed); - proto.write(PrintSpoolerStateProto.IS_BOUND, mRemoteInstance != null); + dumpStream.write("is_destroyed", PrintSpoolerStateProto.IS_DESTROYED, mDestroyed); + dumpStream.write("is_bound", PrintSpoolerStateProto.IS_BOUND, mRemoteInstance != null); } try { - proto.write(PrintSpoolerStateProto.INTERNAL_STATE, - TransferPipe.dumpAsync(getRemoteInstanceLazy().asBinder(), "--proto")); + if (dumpStream.isProto()) { + dumpStream.write(null, PrintSpoolerStateProto.INTERNAL_STATE, + TransferPipe.dumpAsync(getRemoteInstanceLazy().asBinder(), "--proto")); + } else { + dumpStream.writeNested("internal_state", TransferPipe.dumpAsync( + getRemoteInstanceLazy().asBinder())); + } } catch (IOException | TimeoutException | RemoteException | InterruptedException e) { Slog.e(LOG_TAG, "Failed to dump remote instance", e); } } - public void dump(FileDescriptor fd, PrintWriter pw, String prefix) { - synchronized (mLock) { - pw.append(prefix).append("destroyed=") - .append(String.valueOf(mDestroyed)).println(); - pw.append(prefix).append("bound=") - .append((mRemoteInstance != null) ? "true" : "false").println(); - - pw.flush(); - try { - TransferPipe.dumpAsync(getRemoteInstanceLazy().asBinder(), fd, - new String[] { prefix }); - } catch (IOException | TimeoutException | RemoteException | InterruptedException e) { - pw.println("Failed to dump remote instance: " + e); - } - } - } - private void onAllPrintJobsHandled() { synchronized (mLock) { throwIfDestroyedLocked(); |