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

Commit 5a87ccf3 authored by Benjamin Gordon's avatar Benjamin Gordon Committed by mse1969
Browse files

PrintSpooler: Require empty output for PDF

When saving to PDF, request a truncated output stream in case the user
selects to overwrite an existing file.

Bug: 423815728
Test: Overwrite existing PDF
Flag: EXEMPT bugfix
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:d65493c65a94415208d4be2454181f214fb2ed03)
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:bfd77aeddc4d3b960a1393ad549e67152179ab1b)
Merged-In: Id598cd1a9d2456566f3905432eb7b5ffeab9d33e
Change-Id: Id598cd1a9d2456566f3905432eb7b5ffeab9d33e
parent fdae2255
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -376,7 +376,7 @@ public final class RemotePrintDocument {
        try {
            file = mDocumentInfo.fileProvider.acquireFile(null);
            in = new FileInputStream(file);
            out = contentResolver.openOutputStream(uri);
            out = contentResolver.openOutputStream(uri, "wt");
            final byte[] buffer = new byte[8192];
            while (true) {
                final int readByteCount = in.read(buffer);