示例#1
0
  /**
   * Logs a call to the call log based on the connection object passed in.
   *
   * @param c The connection object for the call being logged.
   * @param callLogType The type of call log entry.
   * @param slotId The slot id for the call being logged.
   */
  public void logCall(Connection c, int callLogType, int slotId) {
    final String number = c.getAddress();
    final long date = c.getCreateTime();
    final long duration = c.getDurationMillis();
    final Phone phone = c.getCall().getPhone();

    final CallerInfo ci = getCallerInfoFromConnection(c); // May be null.
    final String logNumber = getLogNumber(c, ci);

    if (DBG) {
      log(
          "- onDisconnect(): logNumber set to:"
              + PhoneUtils.toLogSafePhoneNumber(logNumber)
              + ", number set to: "
              + PhoneUtils.toLogSafePhoneNumber(number));
    }

    /// M: @{
    mPhoneType = phone.getPhoneType();
    mIsComing = c.isIncoming();
    if (FeatureOption.MTK_VT3G324M_SUPPORT) {
      mVtCall = c.isVideo() ? 1 : 0;
    }
    PhoneLog.d(LOG_TAG, "number=" + number + ", duration=" + duration + ", isVT=" + mVtCall);
    /// @}

    /// M: For ALPS00114062 @{
    // show every connection's last time of conference call.
    if (needToShowCallTime(c, duration)) {
      Toast.makeText(
              mApplication.getApplicationContext(),
              formatDuration((int) (duration / 1000)),
              Toast.LENGTH_SHORT)
          .show();
    }
    /// @}

    // TODO: In getLogNumber we use the presentation from
    // the connection for the CNAP. Should we use the one
    // below instead? (comes from caller info)

    // For international calls, 011 needs to be logged as +
    final int presentation = getPresentation(c, ci);

    final boolean isOtaspNumber =
        TelephonyCapabilities.supportsOtasp(phone) && phone.isOtaSpNumber(number);

    // Don't log OTASP calls.
    if (!isOtaspNumber) {
      logCall(ci, logNumber, presentation, callLogType, date, duration, slotId);
    }
  }