blob: f006ccb94247da954513f93999b2651ce70c214f [file] [log] [blame]
Svetoslav Ganov8c433762013-08-02 14:22:19 -07001/*
2 * Copyright (C) 2013 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
Svetoslava798c0a2014-05-15 10:47:19 -070017package com.android.printspooler.model;
Svetoslav Ganov8c433762013-08-02 14:22:19 -070018
19import android.app.Notification;
Philip P. Moltmanndd635ce2015-11-20 16:35:05 -080020import android.app.Notification.Action;
Svetoslav Ganova18661d2013-10-09 22:55:49 -070021import android.app.Notification.InboxStyle;
Svetoslav Ganov8c433762013-08-02 14:22:19 -070022import android.app.NotificationManager;
23import android.app.PendingIntent;
24import android.content.BroadcastReceiver;
25import android.content.Context;
26import android.content.Intent;
Svetoslav Ganova18661d2013-10-09 22:55:49 -070027import android.graphics.drawable.BitmapDrawable;
Philip P. Moltmanndd635ce2015-11-20 16:35:05 -080028import android.graphics.drawable.Icon;
Svetoslav Ganova18661d2013-10-09 22:55:49 -070029import android.net.Uri;
Svetoslav Ganov835835e2013-08-04 20:17:52 -070030import android.os.AsyncTask;
Svetoslav Ganov835835e2013-08-04 20:17:52 -070031import android.os.PowerManager;
32import android.os.PowerManager.WakeLock;
Svetoslav Ganov8c433762013-08-02 14:22:19 -070033import android.os.RemoteException;
34import android.os.ServiceManager;
35import android.os.UserHandle;
36import android.print.IPrintManager;
Svetoslav2fbd2a72013-09-16 17:53:51 -070037import android.print.PrintJobId;
Svetoslav Ganov8c433762013-08-02 14:22:19 -070038import android.print.PrintJobInfo;
39import android.print.PrintManager;
Svetoslav Ganov704697b2013-09-21 20:30:24 -070040import android.provider.Settings;
Svetoslav Ganov8c433762013-08-02 14:22:19 -070041import android.util.Log;
42
Svetoslava798c0a2014-05-15 10:47:19 -070043import com.android.printspooler.R;
44
Svetoslav Ganova18661d2013-10-09 22:55:49 -070045import java.util.ArrayList;
46import java.util.List;
47
Svetoslav Ganov8c433762013-08-02 14:22:19 -070048/**
49 * This class is responsible for updating the print notifications
50 * based on print job state transitions.
51 */
Svetoslava798c0a2014-05-15 10:47:19 -070052final class NotificationController {
Svetoslav2fbd2a72013-09-16 17:53:51 -070053 public static final boolean DEBUG = false;
Svetoslav Ganov8c433762013-08-02 14:22:19 -070054
55 public static final String LOG_TAG = "NotificationController";
56
57 private static final String INTENT_ACTION_CANCEL_PRINTJOB = "INTENT_ACTION_CANCEL_PRINTJOB";
58 private static final String INTENT_ACTION_RESTART_PRINTJOB = "INTENT_ACTION_RESTART_PRINTJOB";
Svetoslav2fbd2a72013-09-16 17:53:51 -070059
Svetoslav Ganov704697b2013-09-21 20:30:24 -070060 private static final String EXTRA_PRINT_JOB_ID = "EXTRA_PRINT_JOB_ID";
Svetoslav Ganov8c433762013-08-02 14:22:19 -070061
62 private final Context mContext;
63 private final NotificationManager mNotificationManager;
64
65 public NotificationController(Context context) {
66 mContext = context;
67 mNotificationManager = (NotificationManager)
68 mContext.getSystemService(Context.NOTIFICATION_SERVICE);
69 }
70
Svetoslav Ganova18661d2013-10-09 22:55:49 -070071 public void onUpdateNotifications(List<PrintJobInfo> printJobs) {
Svet Ganova4ab78082014-07-14 08:40:12 -070072 List<PrintJobInfo> notifyPrintJobs = new ArrayList<>();
Svetoslav Ganov8c433762013-08-02 14:22:19 -070073
Svetoslav Ganova18661d2013-10-09 22:55:49 -070074 final int printJobCount = printJobs.size();
75 for (int i = 0; i < printJobCount; i++) {
76 PrintJobInfo printJob = printJobs.get(i);
77 if (shouldNotifyForState(printJob.getState())) {
78 notifyPrintJobs.add(printJob);
79 }
80 }
81
82 updateNotification(notifyPrintJobs);
83 }
84
85 private void updateNotification(List<PrintJobInfo> printJobs) {
86 if (printJobs.size() <= 0) {
87 removeNotification();
88 } else if (printJobs.size() == 1) {
89 createSimpleNotification(printJobs.get(0));
90 } else {
91 createStackedNotification(printJobs);
92 }
93 }
94
95 private void createSimpleNotification(PrintJobInfo printJob) {
96 switch (printJob.getState()) {
Svetoslav Ganov8c433762013-08-02 14:22:19 -070097 case PrintJobInfo.STATE_FAILED: {
Svetoslav Ganovd26d4892013-08-28 14:37:54 -070098 createFailedNotification(printJob);
Svetoslav Ganov8c433762013-08-02 14:22:19 -070099 } break;
100
Svetoslav Ganova18661d2013-10-09 22:55:49 -0700101 case PrintJobInfo.STATE_BLOCKED: {
102 if (!printJob.isCancelling()) {
103 createBlockedNotification(printJob);
104 } else {
105 createCancellingNotification(printJob);
106 }
Svetoslav Ganov8c433762013-08-02 14:22:19 -0700107 } break;
Svetoslav Ganovd26d4892013-08-28 14:37:54 -0700108
Svetoslav Ganova18661d2013-10-09 22:55:49 -0700109 default: {
110 if (!printJob.isCancelling()) {
111 createPrintingNotification(printJob);
112 } else {
113 createCancellingNotification(printJob);
114 }
Svetoslav Ganovd26d4892013-08-28 14:37:54 -0700115 } break;
Svetoslav Ganov8c433762013-08-02 14:22:19 -0700116 }
117 }
118
Philip P. Moltmanndd635ce2015-11-20 16:35:05 -0800119 /**
120 * Create an {@link Action} that cancels a {@link PrintJobInfo print job}.
121 *
122 * @param printJob The {@link PrintJobInfo print job} to cancel
123 *
124 * @return An {@link Action} that will cancel a print job
125 */
126 private Action createCancelAction(PrintJobInfo printJob) {
127 return new Action.Builder(
128 Icon.createWithResource(mContext, R.drawable.stat_notify_cancelling),
129 mContext.getString(R.string.cancel), createCancelIntent(printJob)).build();
130 }
131
Svetoslav Ganovd26d4892013-08-28 14:37:54 -0700132 private void createPrintingNotification(PrintJobInfo printJob) {
Svetoslav Ganov8c433762013-08-02 14:22:19 -0700133 Notification.Builder builder = new Notification.Builder(mContext)
Svetoslav Ganov704697b2013-09-21 20:30:24 -0700134 .setContentIntent(createContentIntent(printJob.getId()))
Svetoslav Ganova18661d2013-10-09 22:55:49 -0700135 .setSmallIcon(computeNotificationIcon(printJob))
136 .setContentTitle(computeNotificationTitle(printJob))
Philip P. Moltmanndd635ce2015-11-20 16:35:05 -0800137 .addAction(createCancelAction(printJob))
Svetoslav Ganov798bed62013-08-11 12:29:39 -0700138 .setContentText(printJob.getPrinterName())
Svetoslav Ganov8c433762013-08-02 14:22:19 -0700139 .setWhen(System.currentTimeMillis())
Svetoslav Ganov835835e2013-08-04 20:17:52 -0700140 .setOngoing(true)
Selim Cinek255dd042014-08-19 22:29:02 +0200141 .setShowWhen(true)
Alan Viverette4a357cd2015-03-18 18:37:18 -0700142 .setColor(mContext.getColor(
Selim Cinek255dd042014-08-19 22:29:02 +0200143 com.android.internal.R.color.system_notification_accent_color));
Svetoslav Ganova18661d2013-10-09 22:55:49 -0700144 mNotificationManager.notify(0, builder.build());
Svetoslav Ganov8c433762013-08-02 14:22:19 -0700145 }
146
Svetoslav Ganovd26d4892013-08-28 14:37:54 -0700147 private void createFailedNotification(PrintJobInfo printJob) {
Philip P. Moltmanndd635ce2015-11-20 16:35:05 -0800148 Action.Builder restartActionBuilder = new Action.Builder(
149 Icon.createWithResource(mContext, R.drawable.ic_restart),
150 mContext.getString(R.string.restart), createRestartIntent(printJob.getId()));
151
Svetoslav Ganov8c433762013-08-02 14:22:19 -0700152 Notification.Builder builder = new Notification.Builder(mContext)
Svetoslav Ganov704697b2013-09-21 20:30:24 -0700153 .setContentIntent(createContentIntent(printJob.getId()))
Svetoslav Ganova18661d2013-10-09 22:55:49 -0700154 .setSmallIcon(computeNotificationIcon(printJob))
155 .setContentTitle(computeNotificationTitle(printJob))
Philip P. Moltmanndd635ce2015-11-20 16:35:05 -0800156 .addAction(createCancelAction(printJob))
157 .addAction(restartActionBuilder.build())
Svetoslav Ganov704697b2013-09-21 20:30:24 -0700158 .setContentText(printJob.getPrinterName())
Svetoslav Ganovd26d4892013-08-28 14:37:54 -0700159 .setWhen(System.currentTimeMillis())
160 .setOngoing(true)
Selim Cinek255dd042014-08-19 22:29:02 +0200161 .setShowWhen(true)
Alan Viverette4a357cd2015-03-18 18:37:18 -0700162 .setColor(mContext.getColor(
Selim Cinek255dd042014-08-19 22:29:02 +0200163 com.android.internal.R.color.system_notification_accent_color));
Svetoslav Ganova18661d2013-10-09 22:55:49 -0700164 mNotificationManager.notify(0, builder.build());
Svetoslav Ganovd26d4892013-08-28 14:37:54 -0700165 }
166
167 private void createBlockedNotification(PrintJobInfo printJob) {
Svetoslav Ganovd26d4892013-08-28 14:37:54 -0700168 Notification.Builder builder = new Notification.Builder(mContext)
Svetoslav Ganov704697b2013-09-21 20:30:24 -0700169 .setContentIntent(createContentIntent(printJob.getId()))
Svetoslav Ganova18661d2013-10-09 22:55:49 -0700170 .setSmallIcon(computeNotificationIcon(printJob))
171 .setContentTitle(computeNotificationTitle(printJob))
Philip P. Moltmanndd635ce2015-11-20 16:35:05 -0800172 .addAction(createCancelAction(printJob))
Svetoslav Ganov704697b2013-09-21 20:30:24 -0700173 .setContentText(printJob.getPrinterName())
Svetoslav Ganov8c433762013-08-02 14:22:19 -0700174 .setWhen(System.currentTimeMillis())
Svetoslav Ganov835835e2013-08-04 20:17:52 -0700175 .setOngoing(true)
Selim Cinek255dd042014-08-19 22:29:02 +0200176 .setShowWhen(true)
Alan Viverette4a357cd2015-03-18 18:37:18 -0700177 .setColor(mContext.getColor(
Selim Cinek255dd042014-08-19 22:29:02 +0200178 com.android.internal.R.color.system_notification_accent_color));
Svetoslav Ganova18661d2013-10-09 22:55:49 -0700179 mNotificationManager.notify(0, builder.build());
Svetoslav Ganov8c433762013-08-02 14:22:19 -0700180 }
181
Svetoslav Ganova18661d2013-10-09 22:55:49 -0700182 private void createCancellingNotification(PrintJobInfo printJob) {
183 Notification.Builder builder = new Notification.Builder(mContext)
184 .setContentIntent(createContentIntent(printJob.getId()))
185 .setSmallIcon(computeNotificationIcon(printJob))
186 .setContentTitle(computeNotificationTitle(printJob))
187 .setContentText(printJob.getPrinterName())
188 .setWhen(System.currentTimeMillis())
189 .setOngoing(true)
Selim Cinek255dd042014-08-19 22:29:02 +0200190 .setShowWhen(true)
Alan Viverette4a357cd2015-03-18 18:37:18 -0700191 .setColor(mContext.getColor(
Selim Cinek255dd042014-08-19 22:29:02 +0200192 com.android.internal.R.color.system_notification_accent_color));
Svetoslav Ganova18661d2013-10-09 22:55:49 -0700193 mNotificationManager.notify(0, builder.build());
194 }
195
196 private void createStackedNotification(List<PrintJobInfo> printJobs) {
197 Notification.Builder builder = new Notification.Builder(mContext)
198 .setContentIntent(createContentIntent(null))
199 .setWhen(System.currentTimeMillis())
200 .setOngoing(true)
201 .setShowWhen(true);
202
203 final int printJobCount = printJobs.size();
204
205 InboxStyle inboxStyle = new InboxStyle();
206 inboxStyle.setBigContentTitle(String.format(mContext.getResources().getQuantityText(
207 R.plurals.composite_notification_title_template,
208 printJobCount).toString(), printJobCount));
209
210 for (int i = printJobCount - 1; i>= 0; i--) {
211 PrintJobInfo printJob = printJobs.get(i);
212 if (i == printJobCount - 1) {
213 builder.setLargeIcon(((BitmapDrawable) mContext.getResources().getDrawable(
Philip P. Moltmanndd635ce2015-11-20 16:35:05 -0800214 computeNotificationIcon(printJob), null)).getBitmap());
Svetoslav Ganovd91cb3e2013-10-12 15:44:42 -0700215 builder.setSmallIcon(computeNotificationIcon(printJob));
Svetoslav Ganova18661d2013-10-09 22:55:49 -0700216 builder.setContentTitle(computeNotificationTitle(printJob));
217 builder.setContentText(printJob.getPrinterName());
218 }
219 inboxStyle.addLine(computeNotificationTitle(printJob));
220 }
221
222 builder.setNumber(printJobCount);
223 builder.setStyle(inboxStyle);
Alan Viverette4a357cd2015-03-18 18:37:18 -0700224 builder.setColor(mContext.getColor(
Selim Cinek255dd042014-08-19 22:29:02 +0200225 com.android.internal.R.color.system_notification_accent_color));
Svetoslav Ganova18661d2013-10-09 22:55:49 -0700226
227 mNotificationManager.notify(0, builder.build());
228 }
229
230 private String computeNotificationTitle(PrintJobInfo printJob) {
231 switch (printJob.getState()) {
232 case PrintJobInfo.STATE_FAILED: {
233 return mContext.getString(R.string.failed_notification_title_template,
234 printJob.getLabel());
235 }
236
237 case PrintJobInfo.STATE_BLOCKED: {
238 if (!printJob.isCancelling()) {
239 return mContext.getString(R.string.blocked_notification_title_template,
240 printJob.getLabel());
241 } else {
242 return mContext.getString(
243 R.string.cancelling_notification_title_template,
244 printJob.getLabel());
245 }
246 }
247
248 default: {
249 if (!printJob.isCancelling()) {
250 return mContext.getString(R.string.printing_notification_title_template,
251 printJob.getLabel());
252 } else {
253 return mContext.getString(
254 R.string.cancelling_notification_title_template,
255 printJob.getLabel());
256 }
257 }
258 }
259 }
260
261 private void removeNotification() {
262 mNotificationManager.cancel(0);
Svetoslav Ganov8c433762013-08-02 14:22:19 -0700263 }
264
Svetoslav Ganov704697b2013-09-21 20:30:24 -0700265 private PendingIntent createContentIntent(PrintJobId printJobId) {
266 Intent intent = new Intent(Settings.ACTION_PRINT_SETTINGS);
Svetoslav Ganova18661d2013-10-09 22:55:49 -0700267 if (printJobId != null) {
268 intent.putExtra(EXTRA_PRINT_JOB_ID, printJobId.flattenToString());
269 intent.setData(Uri.fromParts("printjob", printJobId.flattenToString(), null));
270 }
271 return PendingIntent.getActivity(mContext, 0, intent, 0);
Svetoslav Ganov704697b2013-09-21 20:30:24 -0700272 }
273
Svetoslav Ganov835835e2013-08-04 20:17:52 -0700274 private PendingIntent createCancelIntent(PrintJobInfo printJob) {
Svetoslav Ganov8c433762013-08-02 14:22:19 -0700275 Intent intent = new Intent(mContext, NotificationBroadcastReceiver.class);
Svetoslav2fbd2a72013-09-16 17:53:51 -0700276 intent.setAction(INTENT_ACTION_CANCEL_PRINTJOB + "_" + printJob.getId().flattenToString());
Svetoslav Ganov704697b2013-09-21 20:30:24 -0700277 intent.putExtra(EXTRA_PRINT_JOB_ID, printJob.getId());
Svetoslav Ganov8c433762013-08-02 14:22:19 -0700278 return PendingIntent.getBroadcast(mContext, 0, intent, PendingIntent.FLAG_ONE_SHOT);
279 }
280
Svetoslav2fbd2a72013-09-16 17:53:51 -0700281 private PendingIntent createRestartIntent(PrintJobId printJobId) {
Svetoslav Ganov8c433762013-08-02 14:22:19 -0700282 Intent intent = new Intent(mContext, NotificationBroadcastReceiver.class);
Svetoslav2fbd2a72013-09-16 17:53:51 -0700283 intent.setAction(INTENT_ACTION_RESTART_PRINTJOB + "_" + printJobId.flattenToString());
Svetoslav Ganov704697b2013-09-21 20:30:24 -0700284 intent.putExtra(EXTRA_PRINT_JOB_ID, printJobId);
Svetoslav Ganov8c433762013-08-02 14:22:19 -0700285 return PendingIntent.getBroadcast(mContext, 0, intent, PendingIntent.FLAG_ONE_SHOT);
286 }
287
Svetoslav Ganova18661d2013-10-09 22:55:49 -0700288 private static boolean shouldNotifyForState(int state) {
289 switch (state) {
290 case PrintJobInfo.STATE_QUEUED:
291 case PrintJobInfo.STATE_STARTED:
292 case PrintJobInfo.STATE_FAILED:
293 case PrintJobInfo.STATE_COMPLETED:
294 case PrintJobInfo.STATE_CANCELED:
295 case PrintJobInfo.STATE_BLOCKED: {
296 return true;
297 }
298 }
299 return false;
300 }
301
302 private static int computeNotificationIcon(PrintJobInfo printJob) {
303 switch (printJob.getState()) {
304 case PrintJobInfo.STATE_FAILED:
305 case PrintJobInfo.STATE_BLOCKED: {
306 return com.android.internal.R.drawable.ic_print_error;
307 }
308 default: {
309 if (!printJob.isCancelling()) {
310 return com.android.internal.R.drawable.ic_print;
311 } else {
312 return R.drawable.stat_notify_cancelling;
313 }
314 }
315 }
316 }
317
Svetoslav Ganov8c433762013-08-02 14:22:19 -0700318 public static final class NotificationBroadcastReceiver extends BroadcastReceiver {
Philip P. Moltmanndd635ce2015-11-20 16:35:05 -0800319 @SuppressWarnings("hiding")
Svetoslav Ganov8c433762013-08-02 14:22:19 -0700320 private static final String LOG_TAG = "NotificationBroadcastReceiver";
321
322 @Override
323 public void onReceive(Context context, Intent intent) {
324 String action = intent.getAction();
325 if (action != null && action.startsWith(INTENT_ACTION_CANCEL_PRINTJOB)) {
Svetoslav Ganov704697b2013-09-21 20:30:24 -0700326 PrintJobId printJobId = intent.getExtras().getParcelable(EXTRA_PRINT_JOB_ID);
Svet Ganova4ab78082014-07-14 08:40:12 -0700327 handleCancelPrintJob(context, printJobId);
Svetoslav Ganov8c433762013-08-02 14:22:19 -0700328 } else if (action != null && action.startsWith(INTENT_ACTION_RESTART_PRINTJOB)) {
Svetoslav Ganov704697b2013-09-21 20:30:24 -0700329 PrintJobId printJobId = intent.getExtras().getParcelable(EXTRA_PRINT_JOB_ID);
Svetoslav Ganov8c433762013-08-02 14:22:19 -0700330 handleRestartPrintJob(context, printJobId);
331 }
332 }
333
Svet Ganova4ab78082014-07-14 08:40:12 -0700334 private void handleCancelPrintJob(final Context context, final PrintJobId printJobId) {
Svetoslav Ganov8c433762013-08-02 14:22:19 -0700335 if (DEBUG) {
336 Log.i(LOG_TAG, "handleCancelPrintJob() printJobId:" + printJobId);
337 }
338
Svetoslav Ganov835835e2013-08-04 20:17:52 -0700339 // Call into the print manager service off the main thread since
340 // the print manager service may end up binding to the print spooler
341 // service which binding is handled on the main thread.
342 PowerManager powerManager = (PowerManager)
343 context.getSystemService(Context.POWER_SERVICE);
344 final WakeLock wakeLock = powerManager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK,
345 LOG_TAG);
346 wakeLock.acquire();
Svetoslav Ganov8c433762013-08-02 14:22:19 -0700347
Svetoslav Ganov835835e2013-08-04 20:17:52 -0700348 new AsyncTask<Void, Void, Void>() {
349 @Override
350 protected Void doInBackground(Void... params) {
351 // We need to request the cancellation to be done by the print
352 // manager service since it has to communicate with the managing
353 // print service to request the cancellation. Also we need the
354 // system service to be bound to the spooler since canceling a
355 // print job will trigger persistence of current jobs which is
356 // done on another thread and until it finishes the spooler has
357 // to be kept around.
358 try {
Svetoslav Ganova18661d2013-10-09 22:55:49 -0700359 IPrintManager printManager = IPrintManager.Stub.asInterface(
360 ServiceManager.getService(Context.PRINT_SERVICE));
Svetoslav Ganov835835e2013-08-04 20:17:52 -0700361 printManager.cancelPrintJob(printJobId, PrintManager.APP_ID_ANY,
362 UserHandle.myUserId());
363 } catch (RemoteException re) {
Svet Ganov525a66b2014-06-14 22:29:00 -0700364 Log.i(LOG_TAG, "Error requesting print job cancellation", re);
Svetoslav Ganov835835e2013-08-04 20:17:52 -0700365 } finally {
366 wakeLock.release();
367 }
368 return null;
369 }
370 }.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, (Void[]) null);
Svetoslav Ganov8c433762013-08-02 14:22:19 -0700371 }
372
Svetoslav2fbd2a72013-09-16 17:53:51 -0700373 private void handleRestartPrintJob(final Context context, final PrintJobId printJobId) {
Svetoslav Ganov8c433762013-08-02 14:22:19 -0700374 if (DEBUG) {
375 Log.i(LOG_TAG, "handleRestartPrintJob() printJobId:" + printJobId);
376 }
377
Svetoslav Ganov835835e2013-08-04 20:17:52 -0700378 // Call into the print manager service off the main thread since
379 // the print manager service may end up binding to the print spooler
380 // service which binding is handled on the main thread.
381 PowerManager powerManager = (PowerManager)
382 context.getSystemService(Context.POWER_SERVICE);
383 final WakeLock wakeLock = powerManager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK,
384 LOG_TAG);
385 wakeLock.acquire();
Svetoslav Ganov8c433762013-08-02 14:22:19 -0700386
Svetoslav Ganov835835e2013-08-04 20:17:52 -0700387 new AsyncTask<Void, Void, Void>() {
388 @Override
389 protected Void doInBackground(Void... params) {
390 // We need to request the restart to be done by the print manager
391 // service since the latter must be bound to the spooler because
392 // restarting a print job will trigger persistence of current jobs
393 // which is done on another thread and until it finishes the spooler has
394 // to be kept around.
395 try {
396 IPrintManager printManager = IPrintManager.Stub.asInterface(
397 ServiceManager.getService(Context.PRINT_SERVICE));
398 printManager.restartPrintJob(printJobId, PrintManager.APP_ID_ANY,
399 UserHandle.myUserId());
400 } catch (RemoteException re) {
Svet Ganov525a66b2014-06-14 22:29:00 -0700401 Log.i(LOG_TAG, "Error requesting print job restart", re);
Svetoslav Ganov835835e2013-08-04 20:17:52 -0700402 } finally {
403 wakeLock.release();
404 }
405 return null;
406 }
407 }.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, (Void[]) null);
Svetoslav Ganov8c433762013-08-02 14:22:19 -0700408 }
409 }
410}