@Override
 public boolean executeNormal() {
   boolean status = false;
   if (mCertificateServer != null
       && mCertificateServer.length() > 0
       && mMeteringId != null
       && mMeteringId.length() > 0) {
     // Send message to engine to get the Metering Certificate challenge
     DrmInfo reply =
         sendInfoRequest(createRequestToGenerateMeterCertChallenge(Constants.DRM_DLS_PIFF_MIME));
     if (reply == null) {
       reply = sendInfoRequest(createRequestToGenerateMeterCertChallenge(Constants.DRM_DLS_MIME));
     }
     if (reply != null) {
       String replyStatus = (String) reply.get(Constants.DRM_STATUS);
       if (replyStatus != null && replyStatus.length() > 0 && replyStatus.equals("ok")) {
         String data = (String) reply.get(Constants.DRM_DATA);
         // Post license challenge to server
         status = postMessage(mCertificateServer, data);
       } else {
         mJobManager.addParameter("HTTP_ERROR", -6);
       }
     } else {
       mJobManager.addParameter("HTTP_ERROR", -6);
       // Log.d(Constants.LOGTAG, "reply is null");
     }
   }
   return status;
 }
  @Override
  protected boolean handleResponse200(String data) {
    try {
      // Send message to engine to store the domain certificate
      DrmInfo reply =
          sendInfoRequest(
              createRequestToProcessJoinDomainResponse(Constants.DRM_DLS_PIFF_MIME, data));
      if (reply == null) {
        reply =
            sendInfoRequest(createRequestToProcessJoinDomainResponse(Constants.DRM_DLS_MIME, data));
      }

      // Process reply
      String replyStatus = (String) reply.get(Constants.DRM_STATUS);
      return replyStatus.equals("ok");
    } catch (NullPointerException e) {
      // Log.w(Constants.LOGTAG, "Unexpected null pointer exception");
    }
    return false;
  }
 @Override
 protected boolean handleResponse200(String data) {
   boolean isOk = false;
   // Send message to engine to process metering certificate
   DrmInfo reply =
       sendInfoRequest(createRequestToProcessMeterCertResponse(Constants.DRM_DLS_PIFF_MIME, data));
   if (reply == null) {
     reply =
         sendInfoRequest(createRequestToProcessMeterCertResponse(Constants.DRM_DLS_MIME, data));
   }
   if (reply != null) {
     String replyStatus = (String) reply.get(Constants.DRM_STATUS);
     // Log.d(Constants.LOGTAG, "status is " + replyStatus);
     if (replyStatus != null && replyStatus.length() > 0 && replyStatus.equals("ok")) {
       // Certificate is stored
       isOk = true;
     } else {
       mJobManager.addParameter("HTTP_ERROR", -6);
     }
   } else {
     mJobManager.addParameter("HTTP_ERROR", -6);
   }
   return isOk;
 }
  @Override
  public boolean executeNormal() {
    boolean isOK = false;
    do {
      if (mController == null) {
        // Log.w(Constants.LOGTAG, "Missing domain controller URL");
        isOK = false;
        break;
      }
      if (mServiceId == Constants.ALL_ZEROS_DRM_ID && mAccountId == Constants.ALL_ZEROS_DRM_ID) {
        // Log.w(Constants.LOGTAG,
        // "Missing both service ID and account ID");
        isOK = false;
        break;
      }

      try {
        String friendlyName = "";
        if (mJobManager.getParameters() != null
            && mJobManager.getParameters().containsKey("FRIENDLY_NAME")) {
          friendlyName = mJobManager.getParameters().getString("FRIENDLY_NAME");
        }

        // Send message to engine to get the join-domain challenge
        DrmInfo reply =
            sendInfoRequest(
                createRequestToGenerateJoinDomainChallenge(
                    Constants.DRM_DLS_PIFF_MIME, friendlyName));
        if (reply == null) {
          reply =
              sendInfoRequest(
                  createRequestToGenerateJoinDomainChallenge(Constants.DRM_DLS_MIME, friendlyName));
        }

        // Process reply
        String replyStatus = (String) reply.get(Constants.DRM_STATUS);
        if (replyStatus.equals("ok")) {
          String data = (String) reply.get(Constants.DRM_DATA);
          isOK = postMessage(mController, data);
        } else {
          mJobManager.addParameter("HTTP_ERROR", -6);
        }
      } catch (NullPointerException e) {
        if (mJobManager != null) {
          mJobManager.addParameter("HTTP_ERROR", -6);
        }
        // Log.w(Constants.LOGTAG, "Unexpected null pointer exception");
      }
    } while (false);

    if (!isOK) {
      StackableJob removedJob = mJobManager.removeJob(DrmFeedbackJob.class.getName());
      DrmFeedbackJob dfj = (DrmFeedbackJob) removedJob;
      Uri uri = null;
      if (dfj != null) {
        if (dfj.getFilePath() != null) {
          uri = Uri.parse(dfj.getFilePath());
        }
        mJobManager.pushJob(new DrmFeedbackJob(dfj.getFeedbackJobType(), "JoinDomain", uri));
      }
    }

    return isOK;
  }