Loading packages/PrintSpooler/src/com/android/printspooler/model/PrintSpoolerProvider.java +3 −1 Original line number Diff line number Diff line Loading @@ -16,6 +16,8 @@ package com.android.printspooler.model; import static android.content.Context.BIND_AUTO_CREATE; import android.content.ComponentName; import android.content.Context; import android.content.Intent; Loading @@ -32,7 +34,7 @@ public class PrintSpoolerProvider implements ServiceConnection { mContext = context; mCallback = callback; Intent intent = new Intent(mContext, PrintSpoolerService.class); mContext.bindService(intent, this, 0); mContext.bindService(intent, this, BIND_AUTO_CREATE); } public PrintSpoolerService getSpooler() { Loading packages/PrintSpooler/src/com/android/printspooler/ui/PrintActivity.java +16 −13 Original line number Diff line number Diff line Loading @@ -306,17 +306,20 @@ public class PrintActivity extends Activity implements RemotePrintDocument.Updat // This will take just a few milliseconds, so just wait to // bind to the local service before showing the UI. mSpoolerProvider = new PrintSpoolerProvider(this, new Runnable() { @Override public void run() { () -> { if (isFinishing() || isDestroyed()) { // onPause might have not been able to cancel the job, see PrintActivity#onPause if (savedInstanceState != null) { // onPause might have not been able to cancel the job, see // PrintActivity#onPause // To be sure, cancel the job again. Double canceling does no harm. mSpoolerProvider.getSpooler().setPrintJobState(mPrintJob.getId(), PrintJobInfo.STATE_CANCELED, null); } } else { onConnectedToPrintSpooler(adapter); if (savedInstanceState == null) { mSpoolerProvider.getSpooler().createPrintJob(mPrintJob); } onConnectedToPrintSpooler(adapter); } }); Loading services/print/java/com/android/server/print/UserState.java +0 −10 Original line number Diff line number Diff line Loading @@ -38,7 +38,6 @@ import android.content.pm.ParceledListSlice; import android.content.pm.ResolveInfo; import android.graphics.drawable.Icon; import android.net.Uri; import android.os.AsyncTask; import android.os.Binder; import android.os.Bundle; import android.os.Handler; Loading Loading @@ -236,15 +235,6 @@ final class UserState implements PrintSpoolerCallbacks, PrintServiceCallbacks, return null; } // Spin the spooler to add the job and show the config UI. new AsyncTask<Void, Void, Void>() { @Override protected Void doInBackground(Void... params) { mSpooler.createPrintJob(printJob); return null; } }.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, (Void[]) null); final long identity = Binder.clearCallingIdentity(); try { Intent intent = new Intent(PrintManager.ACTION_PRINT_DIALOG); Loading Loading
packages/PrintSpooler/src/com/android/printspooler/model/PrintSpoolerProvider.java +3 −1 Original line number Diff line number Diff line Loading @@ -16,6 +16,8 @@ package com.android.printspooler.model; import static android.content.Context.BIND_AUTO_CREATE; import android.content.ComponentName; import android.content.Context; import android.content.Intent; Loading @@ -32,7 +34,7 @@ public class PrintSpoolerProvider implements ServiceConnection { mContext = context; mCallback = callback; Intent intent = new Intent(mContext, PrintSpoolerService.class); mContext.bindService(intent, this, 0); mContext.bindService(intent, this, BIND_AUTO_CREATE); } public PrintSpoolerService getSpooler() { Loading
packages/PrintSpooler/src/com/android/printspooler/ui/PrintActivity.java +16 −13 Original line number Diff line number Diff line Loading @@ -306,17 +306,20 @@ public class PrintActivity extends Activity implements RemotePrintDocument.Updat // This will take just a few milliseconds, so just wait to // bind to the local service before showing the UI. mSpoolerProvider = new PrintSpoolerProvider(this, new Runnable() { @Override public void run() { () -> { if (isFinishing() || isDestroyed()) { // onPause might have not been able to cancel the job, see PrintActivity#onPause if (savedInstanceState != null) { // onPause might have not been able to cancel the job, see // PrintActivity#onPause // To be sure, cancel the job again. Double canceling does no harm. mSpoolerProvider.getSpooler().setPrintJobState(mPrintJob.getId(), PrintJobInfo.STATE_CANCELED, null); } } else { onConnectedToPrintSpooler(adapter); if (savedInstanceState == null) { mSpoolerProvider.getSpooler().createPrintJob(mPrintJob); } onConnectedToPrintSpooler(adapter); } }); Loading
services/print/java/com/android/server/print/UserState.java +0 −10 Original line number Diff line number Diff line Loading @@ -38,7 +38,6 @@ import android.content.pm.ParceledListSlice; import android.content.pm.ResolveInfo; import android.graphics.drawable.Icon; import android.net.Uri; import android.os.AsyncTask; import android.os.Binder; import android.os.Bundle; import android.os.Handler; Loading Loading @@ -236,15 +235,6 @@ final class UserState implements PrintSpoolerCallbacks, PrintServiceCallbacks, return null; } // Spin the spooler to add the job and show the config UI. new AsyncTask<Void, Void, Void>() { @Override protected Void doInBackground(Void... params) { mSpooler.createPrintJob(printJob); return null; } }.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, (Void[]) null); final long identity = Binder.clearCallingIdentity(); try { Intent intent = new Intent(PrintManager.ACTION_PRINT_DIALOG); Loading