/**
     * Handle incoming transaction requests. The incoming requests are initiated by the MMSC Server
     * or by the MMS Client itself.
     */
    @Override
    public void handleMessage(Message msg) {
      int serviceId = msg.arg1;
      Intent intent = (Intent) msg.obj;
      if (Log.isLoggable(LogTag.TRANSACTION, Log.VERBOSE)) {
        Log.v(TAG, "handleMessage serviceId: " + serviceId + " intent: " + intent);
      }
      if (intent != null) {
        String action = intent.getAction();

        int error = intent.getIntExtra("errorCode", 0);

        if (Log.isLoggable(LogTag.TRANSACTION, Log.VERBOSE)) {
          Log.v(TAG, "handleMessage action: " + action + " error: " + error);
        }

        if (MESSAGE_SENT_ACTION.equals(intent.getAction())) {
          handleSmsSent(intent, error);
        } else if (SMS_RECEIVED_ACTION.equals(action)) {
          handleSmsReceived(intent, error);
        } else if (ACTION_BOOT_COMPLETED.equals(action)) {
          handleBootCompleted();
        } else if (TelephonyIntents.ACTION_SERVICE_STATE_CHANGED.equals(action)) {
          handleServiceStateChanged(intent);
        } else if (ACTION_SEND_MESSAGE.endsWith(action)) {
          handleSendMessage();
        } else if (ACTION_SEND_INACTIVE_MESSAGE.equals(action)) {
          handleSendInactiveMessage();
        }
      }
      // NOTE: We MUST not call stopSelf() directly, since we need to
      // make sure the wake lock acquired by AlertReceiver is released.
      SmsReceiver.finishStartingService(SmsReceiverService.this, serviceId);
    }
    @Override
    public void handleMessage(Message msg) {
      if (Log.DEBUG) Log.v("SMSReceiverService: handleMessage()");

      int serviceId = msg.arg1;
      Intent intent = (Intent) msg.obj;
      String action = intent.getAction();
      String dataType = intent.getType();

      if (ACTION_SMS_RECEIVED.equals(action)) {
        handleSmsReceived(intent);
      } else if (ACTION_MMS_RECEIVED.equals(action) && MMS_DATA_TYPE.equals(dataType)) {
        handleMmsReceived(intent);
      } else if (MESSAGE_SENT_ACTION.equals(action)) {
        handleSmsSent(intent);
      } else if (ACTION_MESSAGE_RECEIVED.equals(action)) {
        handleMessageReceived(intent);
      }

      // NOTE: We MUST not call stopSelf() directly, since we need to
      // make sure the wake lock acquired by AlertReceiver is released.
      finishStartingService(SmsReceiverService.this, serviceId);
    }