summaryrefslogtreecommitdiff
path: root/packages/PrintSpooler/src
AgeCommit message (Collapse)Author
2025-09-18[SP 2025-09-01] PrintSpooler: Require empty output for PDF Benjamin Gordon
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) Merged-In: Id598cd1a9d2456566f3905432eb7b5ffeab9d33e Change-Id: Id598cd1a9d2456566f3905432eb7b5ffeab9d33e
2025-02-11Merge "PreviewPageFrame checked state updates" into main Yinglei Wang
2025-01-24Add new invalid state to print spooler Nathan Muggli
When a PDF file is invalid (corrupt PDF file, password-protected, etc) and can't be rendered, switch to an invalid state. No further updates happen when the file is known to be invalid and the spooler is in an invalid state. This prevents a crash where an update was trying to be performed when in the finished state. Additionally, don't allow the user to attempt to restart a print job with an invalid file since it will simply fail again. Bug: 389956791 Flag: EXEMPT bug fix Test: Manual test on akita and brya with password-protected file Change-Id: I8217463ba3d43a7b898019bdc84443cc43f9d042
2025-01-16PreviewPageFrame checked state updates Yinglei Wang
Send the new checked event. Updated to the new checked api. This widget is using getSelected() as the checked state. We can't send the event in setSelected() because setSelected in called in onBindViewHolder and the widget is not attached yet. So we send the new event when the widget is clicked. Test: tested on the print preview and checked the new event is sent when clicked. Flag: android.view.accessibility.tri_state_checked Bug: 380327448 Change-Id: I1591425bf7d35ef361cae94ee394cb26b20014ff
2025-01-10PrintSpooler edge to edge support Marzia Favaro
PrintContentView now fits system windows. Handle the insets in PrintContentView to accomodate the padding introduced by this. Reverts ag/26955039 and ag/27354397. Bug: 378652618 Test: Manual verification that all the elements are visible, interactable and in the expected position Flag: com.android.printspooler.flags.print_edge2edge Change-Id: Ib6c533fedbbc45e0340a389fba71f81be17fedf4
2025-01-08Add print job logging Benjamin Gordon
To assist with debugging from bug reports, log when print jobs are created, removed, or updated. Bug: 385340868 Test: manual printing Flag: com.android.printspooler.flags.log_print_jobs Change-Id: Id15a8d126b4a34f7b27fcd36d398a1c83ec85b20
2024-11-20Migrate PrintActivity to enableOnBackInvokedCallback=true Johannes Gallmann
Bug: 379263789 Bug: 376407910 Test: CtsPrintTestCases Test: Manual, i.e. verified that PrintActivity has same back navigation behaviour with and without this CL applied. (tested within Files app after `m PrintSpooler; adevice update`) Flag: EXEMPT bugfix Change-Id: I53a34b448b520da7193eadadef09fc2cd99debbd
2024-10-17Handle malformed PDFs gracefully in PrintSpooler krhardeep
The PrintSpooler now handles malformed PDFs by marking the print job as failed and calling finish(), preventing RuntimeException Bug: 367448551 Flag: EXEMPT bug fix Test: atest IPrintManagerParametersTest, tested in test app on a physical device Change-Id: I54d14b270741172eff7e4147ad59b2e0d39ab188
2024-09-11Merge "Page rendering not cancelled exception in renderPage" into main Hardeep Kaur
2024-09-11Page rendering not cancelled exception in renderPage krhardeep
- Fix concurrency issue in renderPage using synchronization - Avoid race condition in renderPage by updating callback instead of throwing exception Test: N/A (manual test) Bug: 344104578 Flag: EXEMPT No automated test available for this concurrency fix Change-Id: I5c8f34eebf830e3c0a131d6fb940b1ef848c3a0d
2024-09-05Cancel printing with escape key Benjamin Gordon
When an external keyboard is attached, users expect to be able to cancel dialogs with the Escape key. Since PrintSpooler already handles this behavior when the Back key is pressed, simply give the Escape key the same behavior. Bug: 364883486 Flag: EXEMPT bug fix Test: Manual comparison of ESC and Back on a keyboard with both Change-Id: I3e54deb1a1cb781fe1d54ea4e19e4476d423e339
2024-05-16Set tracking state properly Ashish Kumar Gupta
When user selects printer from Select printer screen, we started tracking last selected printer instead of selected printer. It is happening due to race condition between onStart and onActivityResult callback. Add a support to start tracking printer from onActivityResult function. Bug: 341016728 Bug: 335214357 Test: atest frameworks/base/packages/PrintSpooler/tests/outofprocess/src/com/android/printspooler/outofprocess/tests/WorkflowTest.java Change-Id: I096bf15d3d3ebc45ffbb05db33ac5936dedc14fa
2023-08-24Add @hide IMM#hideSoftInputFromView as an optimization Yohei Yukawa
It seems that it is relatively a common pattern used in the Framework code when trying to hide a software keyboard. var imm = view.getSystemService(InputMethodManager.class); if (imm != null && imm.isActive(view)) { imm.hideSoftInputFromWindow(view.getWindowToken(), 0); } The above code can be easily optimized by introducing a counterpart of InputMethodManager#showSoftInput(View view, int flags); so that the hide request can be issued when and only when the specified view has already established a connection to the IME. The optimized code would look like as follows. var imm = view.getSystemService(InputMethodManager.class); if (imm != null) { imm.hideSoftInputFromView(view, 0); } Major advantages of such an approach are: * IMM#checkFocus() can never be called. * IMM needs to take a lock only once. With above, this CL introduces IMM#hideSoftInputFromView() as @hide method so that we can start making sure that such an approach works well. Fix: 296466613 Test: atest CtsInputMethodTestCases:EditTextImeSupportTest Change-Id: I01e5a29c0f82d068751774a2c58a1bd7b7b7f91a
2023-08-09Allow BAL from SelectPrinterActivity Achim Thesmann
This allows the info button on each printer to open an activity as expected. Bug: 277761614 Test: manual test, presubmit (cherry picked from https://googleplex-android-review.googlesource.com/q/commit:0633d417ebe399fae024572ae2008e1f86ee437d) Merged-In: Ibe4bd6eabdc61be3b1237aa313b575cd85a69226 Change-Id: Ibe4bd6eabdc61be3b1237aa313b575cd85a69226
2022-11-14Fix errorprone warnings that should be errors Cole Faust
This commit is part of a large scale change to fix errorprone errors that have been downgraded to warnings in the android source tree, so that they can be promoted to errors again. The full list of changes include the following, but not all will be present in any one individual commit: BadAnnotationImplementation BadShiftAmount BanJNDI BoxedPrimitiveEquality ComparableType ComplexBooleanConstant CollectionToArraySafeParameter ConditionalExpressionNumericPromotion DangerousLiteralNull DoubleBraceInitialization DurationFrom DurationTemporalUnit EmptyTopLevelDeclaration EqualsNull EqualsReference FormatString FromTemporalAccessor GetClassOnAnnotation GetClassOnClass HashtableContains IdentityBinaryExpression IdentityHashMapBoxing InstantTemporalUnit InvalidTimeZoneID InvalidZoneId IsInstanceIncompatibleType JUnitParameterMethodNotFound LockOnBoxedPrimitive MathRoundIntLong MislabeledAndroidString MisusedDayOfYear MissingSuperCall MisusedWeekYear ModifyingCollectionWithItself NoCanIgnoreReturnValueOnClasses NonRuntimeAnnotation NullableOnContainingClass NullTernary OverridesJavaxInjectableMethod ParcelableCreator PeriodFrom PreconditionsInvalidPlaceholder ProtoBuilderReturnValueIgnored ProtoFieldNullComparison RandomModInteger RectIntersectReturnValueIgnored ReturnValueIgnored SelfAssignment SelfComparison SelfEquals SizeGreaterThanOrEqualsZero StringBuilderInitWithChar TreeToString TryFailThrowable UnnecessaryCheckNotNull UnusedCollectionModifiedInPlace XorPower See https://errorprone.info/bugpatterns for more information on the checks. Bug: 253827323 Test: m RUN_ERROR_PRONE=true javac-check Change-Id: I8446f9076a45ebf7e7ffa06cb0d4ddb1001b6c00
2022-01-07Add the PrintSpoolerLib module in Soong Yuntao Xu
Added the PrintSpoolerLib module that is used as one dependency of the ArcPrintSpooler module. Bug: 205649904 Bug: 211801887 Test: compared the two apk files built by Make and Soong Test: TreeHugger Change-Id: I9b6d0c9f4620ed58d5be55862f9a18dcfefa9cfa
2021-06-18Catch NoSuchElementException when unbinding print doc death recipient Erik Wolsheimer
Fixes: 177873499 Test: Manual Change-Id: Ia77e6d2c9d7e552beb0a2df10d6d4f13c7230446
2020-10-14Add quality to LocationRequest/ProviderRequest Soonil Nagarkar
Expose quality APIs publically after refactoring them to match external usage of quality constants. Removes list of location requests from provider request, as there is no client that really uses this, and it feels like too much information to give to providers. Bug: 168624248 Test: presubmits Change-Id: Icf8a9f6096da0071d97190d3f7196948492e52a1
2020-09-11Make LocationRequest a public API Soonil Nagarkar
LocationRequest and associated APIs have historically always been SystemApi, for no real reason. In keeping with the Android-wide push to clean up API surfaces like this, we make LocationRequest a public API. Bug: 166692379 Test: manual + presubmits Change-Id: I6a93fca1a5613c96bf35da158bc542e47864dbff
2020-07-06Make Print notification intent immutable Philip P. Moltmann
They are not meant fro modification. Test: Clicked on a notification to follow the intent Fixes: 156009434 Change-Id: I04abfb4def70f05b30a2a35c8889c5a1a6857de0
2020-05-17Always call back when printer changes Philip P. Moltmann
Otherwise it can happen that we swallow previous printer updates and never end up getting a valid on-printers-updated call. Fixes: 156222510 Test: atest PrinterDiscoverySessionLifecycleTest Change-Id: Idab7399a6ab41ba9051cfcbbeebf4c45d6bfc053
2019-10-18Move away from deprecated API Soonil Nagarkar
Replace requestSingleUpdate() with getCurrentLocation(). Bug: 133356925 Test: none Change-Id: I2416c5526f0c7cd54c8d7a6d7b042a32cc768218
2019-05-22Don't fire 'changed' event if printer list is not updated yoshiki iguchi
The printer list is tried to be updated when the network is changed but the 'changed' event was fired even if the printer list is not changed at all. This CL suppresses events if the list is not changed. Bug: 132840441 Test: run 'cts-tradefed run commandAndExit cts-dev --module CtsPrintTestCases --test android.print.cts. PrintDocumentAdapterContractTest#unexpectedLayoutCancel' 30 times Change-Id: I9236e56ea9e19e37be29d6a1d0015ee0b2676460
2019-01-25Move SettingsLib icons to android. Amin Shaikh
Bug: 122263617 Test: make Change-Id: I11ce02f3f65f429fd4375a5522c060c8080f4813
2018-10-02Print document generation: Schedule new layout if current command is canceling Philip P. Moltmann
In this case the mUpdateSpec will be marked as stale once the command is done, hence we have to start from scratch. Fixes: 117124112 Test: - Reproduced scenario in bug - atest CtsPrintTestCases Change-Id: I98e11d28147bae638d68b2124507d04f825a392f
2018-07-12Merge "Utility methods useful for working with files." Jeff Sharkey
2018-07-11Utility methods useful for working with files. Jeff Sharkey
Part of getting DocumentsUI ready for building against public API. Test: builds Bug: 110959821 Change-Id: I7cc0acd5ac3bcc89790cb49f34291ae523e44019
2018-07-09Use light theme for printSpooler Philip P. Moltmann
- replace png's by vector graphics - Use alredy existing icons if possible - Remove unnnecessary hard coded color values - hard code all colors for preview-page as the background colors are hard coded, hence foreground also needs to be hard coded. - Unify layout of loading/error/select printer UI Test: Looked at print spooler. Switched theme to dark and checked if all looks ok too. Change-Id: I07cc619d575c7372bd18550db8f2582df657cc5c
2018-05-15Hold wake lock while printing Philip P. Moltmann
more specifically while any print job is - queued (ready to be printed but not yet printing) - started (actually printing right now) - cancelling (printing, but cancel request has been sent) Test: - Printed successfully - Canceled print job - Had print job that blocked Wake locks looked fine while doing all this Fixes: 74811014 Change-Id: Ia1a3327bd55fb7f3cc7ecb330d7d2c141d4fdb34
2018-05-10Allow Print subsystem to work with services provided by instant app Philip P. Moltmann
Most functionality works, but the PrintActivity cannot directly interact with the instant service. As instant services should only appear in tests this functionality needs to be enabled via shell commands. Fixes: 79484768 Test: cts-tradefed run commandAndExit cts-instant-dev -m CtsPrintTestCases cts-tradefed run commandAndExit cts-dev -m CtsPrintTestCases Change-Id: Ie4663c72b8c0f959b5d172ef28875479d120e386
2018-02-23Merge "Use PooledLambda in print code" TreeHugger Robot
2018-02-23Use PooledLambda in print code Eugene Susla
This replaces the usage of handler message types with PooledLambda Test: atest CtsPrintTestCases Change-Id: I19b01278b67b5fe18d48a2e0bb8300bbe1413a63
2018-02-21Create print job when print activity starts Philip P. Moltmann
This guarantees that the print job is created before the print activity deals with it. Test: CtsPrintTestCases Change-Id: I3451fff71bd981beb45882b7b42d4cc49d63a91c Fixes: 73127052
2018-02-15Merge "Do not transform again on crash" Philip P. Moltmann
2018-02-14Do not transform again on crash Philip P. Moltmann
Before: onServiceConnected AsyncTask 1: doInBackground doTransform PdfEditor service crashes system restarts PdfEditor service -> onServiceConnected AsyncTask 2: doInBackground doTransform onPostExecute Unbind from service AsyncTask 1: onPostExecute Unbind from service again -> crash Hence we have to only ever create a single async task even if we get another onServiceConnected. Test: atest CtsPrintTestCases Change-Id: Ia18e82fe6258bac9395557b2056645e87a752889 Fixes: 73127227
2018-02-14Don't attempt to create context menu for 'add printer' entry Philip P. Moltmann
As the 'printer' variable becomes null and the activity crashes. This could also be solved to register context menu's for each printer entry (and not for the 'add printer' entry). Then we would need to create a custom view for the printer entry that returns a ContextMenuInfo containing the printer ID. While this solution is cleaner, it is much more complex. Test: Tried to open context menu in 'add printer' entry Change-Id: I23dcba2dd876cff27b5cad9736f5ec4524985bac Fixes: 73126748
2018-02-02Dump usb as DualDump Philip P. Moltmann
This allows to dump the USB state as proto-buf. This in turn allows to automatically process this data. Test: adb shell dumpsys usb incident_report usb No automated test possible as no field is guaranteed to be set Change-Id: Ifdf22bfaf9c78226c420b11c43278013ce69f849
2018-01-29Merge "Reduce pss collection amount, improve logging." TreeHugger Robot
2018-01-26Reduce pss collection amount, improve logging. Dianne Hackborn
Tuned rates that we collect PSS, to reduce how much we do that heavy operation. Added a new way to determine whether a process has changed to a state for the "first" time -- now this is when it has gone to that state for the first time since it was in a lower state. This will reduce the amount of time we consider a process to be first to only when it has previously gone into a higher state than it had before. Keep track of more fine-grained information about why we collect a PSS sample (not just internal, but for a single process, all processes because of a mem state change, all processes because of a poll). Started collecting RSS in various places, so we can start looking at that w.r.t. PSS and see about transitioning to it is a new primary metric. Added logging for many of the places where the system writes its configuration files, so we can more easily see any bad behavior going on in those areas. Added some currently disabled code to read smaps directly instead of using fgets(). Probably won't help, but want tot test. Bug: 70859548 Test: atest CtsAppTestCases Change-Id: I400dba0f3ae9c024df51c946cfa592561028b598
2018-01-26Revert "Move A11y events throttling away from View(RootImpl)" Eugene Susla
This reverts commit e4d31b3c103045d5b2b141a05084dced595cc64f. Fixes: 71904218 Test: presubmit Change-Id: Id73bde1a0c11696cf561c84cde027cdca4c6a00f
2018-01-17Follow up I1f0c56651eaa59f0ce90cdb08c71e89a96c48dd4 Philip P. Moltmann
Beside addressing the comments on this change, this adds a check that the token in end( is correct and prints a message if not. This is useful when creating new dumping methods. Test: adb shell dumpsys print Change-Id: Ic2e6152cbd82f98d9d305a15edffc69c55fd1fd3
2018-01-16Only have one way of dumping print manager state Philip P. Moltmann
Add a class DualDumpOutputStream that maps proto-dump commands onto print writer commands. The effect of this is that there is only one - very proto dump like - way to dump the print manager which is much easier to maintain. The DualDumpOutputStream tries to produce a result similar to the incident-report tool. Test: adb shell dumpsys print Change-Id: I1f0c56651eaa59f0ce90cdb08c71e89a96c48dd4
2018-01-11Merge "Move A11y events throttling away from View(RootImpl)" TreeHugger Robot
2018-01-09Move A11y events throttling away from View(RootImpl) Eugene Susla
..and also extract common code into a common superclass This also preserves the order of the throttled events (TYPE_VIEW_SCROLLED & TYPE_WINDOW_CONTENT_CHANGED) with regards to the rest of events by flushing any pending throttled events immediately if another event is requested to be sent. Test: ensure no new a11y CTS failures Change-Id: I948a16716521974393aaa1cf822d0a0324e9ce3a
2017-12-28Make print options layout respect RTL Ng Zhi An
Bug: 69693271 Test: manual, in a RTL system language, build, sync, open a PDF, print Change-Id: I90e0dabfee1256663a4bececb0538f91389cfaac
2017-11-13Make ic_print and ic_print_error vector graphics Philip P. Moltmann
This makes very high resolution versions of the icon appear sharper. Fixes: 69175097 Test: Looked at places where the icon shows in the UI. Looks like before, just sharper. Change-Id: I2bf24c08605e6e4949892dcb720005497f1fadfa
2017-09-01Merge "Disable more options while in progress" TreeHugger Robot
2017-08-31Merge "Do not call MediaSizeComp before it is initalized" TreeHugger Robot
2017-08-30Reset update spec after canceled layout Philip P. Moltmann
When we cancel a layout there are two cases. Either we already scheduled the next layout. In this case operate as before as the update-spec was updated to the new update. In there is no new layout we have to reset the update spec as the last command was canceled and the state of the remotePrintDocument has become invalid. The resetted update spec forces a new update the next time update() is called. Fixes: 64911776 Test: cts-tradefed run cts-dev -m Print Added two new tests reproducing the scenarios mentioned in the bug. Change-Id: Icad8da5fd985aed1cc201076ee7262f6d6541380
2017-08-29Disable more options while in progress Philip P. Moltmann
Otherwise tapping the button quickly enough can cause the activity to open twice. Change-Id: I007d7ee7d8d271111dc919f195a487a9c65d2bdf Fixes: 63647922 Test: cts-tradefed run cts-dev -m Print