public void updateHeaders(Uri uri,SendReq sendReq){
synchronized (PDU_CACHE_INSTANCE) {
    if (PDU_CACHE_INSTANCE.isUpdating(uri)) {
      if (LOCAL_LOGV)       Log.v(TAG,"updateHeaders: " + uri + " blocked by isUpdating()");
      try {
        PDU_CACHE_INSTANCE.wait();
      }
 catch (      InterruptedException e) {
        Log.e(TAG,"updateHeaders: ",e);
      }
    }
  }
  PDU_CACHE_INSTANCE.purge(uri);
  ContentValues values=new ContentValues(10);
  byte[] contentType=sendReq.getContentType();
  if (contentType != null) {
    values.put("ct_t",toIsoString(contentType));
  }
  long date=sendReq.getDate();
  if (date != -1) {
    values.put("date",date);
  }
  int deliveryReport=sendReq.getDeliveryReport();
  if (deliveryReport != 0) {
    values.put("d_rpt",deliveryReport);
  }
  long expiry=sendReq.getExpiry();
  if (expiry != -1) {
    values.put("exp",expiry);
  }
  byte[] msgClass=sendReq.getMessageClass();
  if (msgClass != null) {
    values.put("m_cls",toIsoString(msgClass));
  }
  int priority=sendReq.getPriority();
  if (priority != 0) {
    values.put("pri",priority);
  }
  int readReport=sendReq.getReadReport();
  if (readReport != 0) {
    values.put("rr",readReport);
  }
  byte[] transId=sendReq.getTransactionId();
  if (transId != null) {
    values.put("tr_id",toIsoString(transId));
  }
  EncodedStringValue subject=sendReq.getSubject();
  if (subject != null) {
    values.put("sub",toIsoString(subject.getTextString()));
    values.put("sub_cs",subject.getCharacterSet());
  }
 else {
    values.put("sub","");
  }
  long messageSize=sendReq.getMessageSize();
  if (messageSize > 0) {
    values.put("m_size",messageSize);
  }
  PduHeaders headers=sendReq.getPduHeaders();
  HashSet<String> recipients=new HashSet<String>();
  for (  int addrType : ADDRESS_FIELDS) {
    EncodedStringValue[] array=null;
    if (addrType == PduHeaders.FROM) {
      EncodedStringValue v=headers.getEncodedStringValue(addrType);
      if (v != null) {
        array=new EncodedStringValue[1];
        array[0]=v;
      }
    }
 else {
      array=headers.getEncodedStringValues(addrType);
    }
    if (array != null) {
      long msgId=ContentUris.parseId(uri);
      updateAddress(msgId,addrType,array);
      if (addrType == PduHeaders.TO) {
        for (        EncodedStringValue v : array) {
          if (v != null) {
            recipients.add(v.getString());
          }
        }
      }
    }
  }
  if (!recipients.isEmpty()) {
    long threadId=Utils.getOrCreateThreadId(mContext,recipients);
    values.put("thread_id",threadId);
  }
  SqliteWrapper.update(mContext,mContentResolver,uri,values,null,null);
}

public void updateHeaders ( Uri uri , SendReq sendReq ) { synchronized ( PDU_CACHE_INSTANCE ) { if ( PDU_CACHE_INSTANCE . isUpdating ( uri ) ) { if ( LOCAL_LOGV ) Log . v ( TAG , "updateHeaders: " + uri + " blocked by isUpdating()" ) ; try { PDU_CACHE_INSTANCE . wait ( ) ; } catch ( InterruptedException e ) { Log . e ( TAG , "updateHeaders: " , e ) ; } } } PDU_CACHE_INSTANCE . purge ( uri ) ; ContentValues values = new ContentValues ( 10 ) ; byte [ ] contentType = sendReq . getContentType ( ) ; if ( contentType != null ) { values . put ( "ct_t" , toIsoString ( contentType ) ) ; } long date = sendReq . getDate ( ) ; if ( date != - 1 ) { values . put ( "date" , date ) ; } int deliveryReport = sendReq . getDeliveryReport ( ) ; if ( deliveryReport != 0 ) { values . put ( "d_rpt" , deliveryReport ) ; } long expiry = sendReq . getExpiry ( ) ; if ( expiry != - 1 ) { values . put ( "exp" , expiry ) ; } byte [ ] msgClass = sendReq . getMessageClass ( ) ; if ( msgClass != null ) { values . put ( "m_cls" , toIsoString ( msgClass ) ) ; } int priority = sendReq . getPriority ( ) ; if ( priority != 0 ) { values . put ( "pri" , priority ) ; } int readReport = sendReq . getReadReport ( ) ; if ( readReport != 0 ) { values . put ( "rr" , readReport ) ; } byte [ ] transId = sendReq . getTransactionId ( ) ; if ( transId != null ) { values . put ( "tr_id" , toIsoString ( transId ) ) ; } EncodedStringValue subject = sendReq . getSubject ( ) ; if ( subject != null ) { values . put ( "sub" , toIsoString ( subject . getTextString ( ) ) ) ; values . put ( "sub_cs" , subject . getCharacterSet ( ) ) ; } else { values . put ( "sub" , "" ) ; } long messageSize = sendReq . getMessageSize ( ) ; if ( messageSize > 0 ) { values . put ( "m_size" , messageSize ) ; } PduHeaders headers = sendReq . getPduHeaders ( ) ; HashSet < String > recipients = new HashSet < String > ( ) ; for ( int addrType : ADDRESS_FIELDS ) { EncodedStringValue [ ] array = null ; if ( addrType == PduHeaders . FROM ) { EncodedStringValue v = headers . getEncodedStringValue ( addrType ) ; if ( v != null ) { array = new EncodedStringValue [ 1 ] ; array [ 0 ] = v ; } } else { array = headers . getEncodedStringValues ( addrType ) ; } if ( array != null ) { long msgId = ContentUris . parseId ( uri ) ; updateAddress ( msgId , addrType , array ) ; if ( addrType == PduHeaders . TO ) { for ( EncodedStringValue v : array ) { if ( v != null ) { recipients . add ( v . getString ( ) ) ; } } } } } if ( ! recipients . isEmpty ( ) ) { long threadId = Utils . getOrCreateThreadId ( mContext , recipients ) ; values . put ( "thread_id" , threadId ) ; } SqliteWrapper . update ( mContext , mContentResolver , uri , values , null , null ) ; }
update headers of a sendreq .
