From bdcd1b47b996f68c543b4d91270a99ed7391921f Mon Sep 17 00:00:00 2001 From: Ashish Kumar Gupta Date: Thu, 16 May 2024 09:32:34 +0000 Subject: Set tracking state properly 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 --- .../PrintSpooler/src/com/android/printspooler/ui/PrintActivity.java | 3 +++ 1 file changed, 3 insertions(+) (limited to 'packages/PrintSpooler/src') diff --git a/packages/PrintSpooler/src/com/android/printspooler/ui/PrintActivity.java b/packages/PrintSpooler/src/com/android/printspooler/ui/PrintActivity.java index d25d5dcaac87..ff09084e24cd 100644 --- a/packages/PrintSpooler/src/com/android/printspooler/ui/PrintActivity.java +++ b/packages/PrintSpooler/src/com/android/printspooler/ui/PrintActivity.java @@ -785,6 +785,9 @@ public class PrintActivity extends Activity implements RemotePrintDocument.Updat } else { onPrinterUnavailable(printerInfo); } + if (mPrinterRegistry != null) { + mPrinterRegistry.setTrackedPrinter(mCurrentPrinter.getId()); + } mDestinationSpinnerAdapter.ensurePrinterInVisibleAdapterPosition(printerInfo); -- cgit v1.2.3-59-g8ed1b