protected void onPause() {
   if ((com.tencent.mm.compatible.util.c.bW(15)) && (ccv != null)) {
     ccv.cancel();
     ccv = null;
   }
   super.onPause();
 }
  @Override
  public void onLayout(
      PrintAttributes oldAttributes,
      PrintAttributes newAttributes,
      CancellationSignal cancellationSignal,
      final LayoutResultCallback callback,
      Bundle extras) {

    cancellationSignal.setOnCancelListener(
        new CancellationSignal.OnCancelListener() {
          @Override
          public void onCancel() {
            callback.onLayoutCancelled();
          }
        });

    pdfDocument = new PrintedPdfDocument(context, newAttributes);
    PrintDocumentInfo info =
        new PrintDocumentInfo.Builder("qr_code.png")
            .setContentType(PrintDocumentInfo.CONTENT_TYPE_DOCUMENT)
            .setPageCount(1)
            .build();

    callback.onLayoutFinished(info, false);
  }
  @Override
  public void cancelLoadInBackground() {
    super.cancelLoadInBackground();

    synchronized (this) {
      if (mCancellationSignal != null) {
        mCancellationSignal.cancel();
      }
    }
  }
 public Object c() {
   if (Build.VERSION.SDK_INT < 16) {
     return null;
   }
   try {
     if (b == null) {
       b = new CancellationSignal();
       if (a) {
         ((CancellationSignal) b).cancel();
       }
     }
     Object localObject1 = b;
     return localObject1;
   } finally {
   }
 }
  @Override
  public void onWrite(
      PageRange[] pages,
      ParcelFileDescriptor destination,
      CancellationSignal cancellationSignal,
      final WriteResultCallback callback) {

    cancellationSignal.setOnCancelListener(
        new CancellationSignal.OnCancelListener() {

          @Override
          public void onCancel() {
            pdfDocument.close();
            pdfDocument = null;
            callback.onWriteCancelled();
          }
        });

    PdfDocument.Page page = pdfDocument.startPage(0);

    Canvas canvas = page.getCanvas();
    canvas.drawBitmap(imageAndTextContainer.getImage(), 0, 0, new Paint());

    pdfDocument.finishPage(page);

    try {
      pdfDocument.writeTo(new FileOutputStream(destination.getFileDescriptor()));
    } catch (IOException e) {
      callback.onWriteFailed(e.toString());
      return;
    } finally {
      pdfDocument.close();
      pdfDocument = null;
    }

    callback.onWriteFinished(pages);
  }
  // Might throw.
  private SQLiteConnection waitForConnection(
      String sql, int connectionFlags, CancellationSignal cancellationSignal) {
    final boolean wantPrimaryConnection =
        (connectionFlags & CONNECTION_FLAG_PRIMARY_CONNECTION_AFFINITY) != 0;

    final ConnectionWaiter waiter;
    final int nonce;
    synchronized (mLock) {
      throwIfClosedLocked();

      // Abort if canceled.
      if (cancellationSignal != null) {
        cancellationSignal.throwIfCanceled();
      }

      // Try to acquire a connection.
      SQLiteConnection connection = null;
      if (!wantPrimaryConnection) {
        connection = tryAcquireNonPrimaryConnectionLocked(sql, connectionFlags); // might throw
      }
      if (connection == null) {
        connection = tryAcquirePrimaryConnectionLocked(connectionFlags); // might throw
      }
      if (connection != null) {
        return connection;
      }

      // No connections available.  Enqueue a waiter in priority order.
      final int priority = getPriority(connectionFlags);
      final long startTime = SystemClock.uptimeMillis();
      waiter =
          obtainConnectionWaiterLocked(
              Thread.currentThread(),
              startTime,
              priority,
              wantPrimaryConnection,
              sql,
              connectionFlags);
      ConnectionWaiter predecessor = null;
      ConnectionWaiter successor = mConnectionWaiterQueue;
      while (successor != null) {
        if (priority > successor.mPriority) {
          waiter.mNext = successor;
          break;
        }
        predecessor = successor;
        successor = successor.mNext;
      }
      if (predecessor != null) {
        predecessor.mNext = waiter;
      } else {
        mConnectionWaiterQueue = waiter;
      }

      nonce = waiter.mNonce;
    }

    // Set up the cancellation listener.
    if (cancellationSignal != null) {
      cancellationSignal.setOnCancelListener(
          new CancellationSignal.OnCancelListener() {
            @Override
            public void onCancel() {
              synchronized (mLock) {
                if (waiter.mNonce == nonce) {
                  cancelConnectionWaiterLocked(waiter);
                }
              }
            }
          });
    }
    try {
      // Park the thread until a connection is assigned or the pool is closed.
      // Rethrow an exception from the wait, if we got one.
      long busyTimeoutMillis = CONNECTION_POOL_BUSY_MILLIS;
      long nextBusyTimeoutTime = waiter.mStartTime + busyTimeoutMillis;
      for (; ; ) {
        // Detect and recover from connection leaks.
        if (mConnectionLeaked.compareAndSet(true, false)) {
          synchronized (mLock) {
            wakeConnectionWaitersLocked();
          }
        }

        // Wait to be unparked (may already have happened), a timeout, or interruption.
        LockSupport.parkNanos(this, busyTimeoutMillis * 1000000L);

        // Clear the interrupted flag, just in case.
        Thread.interrupted();

        // Check whether we are done waiting yet.
        synchronized (mLock) {
          throwIfClosedLocked();

          final SQLiteConnection connection = waiter.mAssignedConnection;
          final RuntimeException ex = waiter.mException;
          if (connection != null || ex != null) {
            recycleConnectionWaiterLocked(waiter);
            if (connection != null) {
              return connection;
            }
            throw ex; // rethrow!
          }

          final long now = SystemClock.uptimeMillis();
          if (now < nextBusyTimeoutTime) {
            busyTimeoutMillis = now - nextBusyTimeoutTime;
          } else {
            logConnectionPoolBusyLocked(now - waiter.mStartTime, connectionFlags);
            busyTimeoutMillis = CONNECTION_POOL_BUSY_MILLIS;
            nextBusyTimeoutTime = now + busyTimeoutMillis;
          }
        }
      }
    } finally {
      // Remove the cancellation listener.
      if (cancellationSignal != null) {
        cancellationSignal.setOnCancelListener(null);
      }
    }
  }