コード例 #1
0
ファイル: CallLogger.java プロジェクト: zst123/p201-packages
 /**
  * Add call number info to call history database for international dialing feature !!!! need to
  * check okToLogThisCall is suitable for international dialing feature
  *
  * @param number The number for the call being logged.
  * @param start The start time of the call being logged.
  * @param duration The duration of the call being logged.
  * @param isSipCall whether sip call
  * @param slotId The slot id for the call being logged.
  */
 private void addCallHistoryAsync(
     String number, long start, long duration, boolean isSipCall, int slotId) {
   final boolean isEmergencyNumber = PhoneNumberUtils.isLocalEmergencyNumber(number, mApplication);
   if (!isEmergencyNumber
       && !mIsComing
       && mVtCall != CALL_TYPE_VIDEO
       && !isSipCall
       && duration >= CallNotifier.CALL_DURATION_THRESHOLD_FOR_CALL_HISTORY
       && slotId > -1) {
     String countryISO = CallOptionUtils.getCurrentCountryISO(PhoneGlobals.getInstance());
     try {
       new CallHistoryAsync()
           .addCall(
               new CallHistoryAsync.AddCallArgs(
                   PhoneGlobals.getInstance(),
                   number,
                   countryISO,
                   start,
                   slotId,
                   GeminiUtils.isGeminiSupport()));
     } catch (SQLiteDiskIOException e) {
       // TODO Auto-generated catch block
       Log.e(LOG_TAG, "Error!! - onDisconnect() Disk Full!");
       e.printStackTrace();
     }
   }
 }
コード例 #2
0
ファイル: CallLogger.java プロジェクト: zst123/p201-packages
  /** Logs a call to the call from the parameters passed in. */
  public void logCall(
      CallerInfo ci,
      String number,
      int presentation,
      int callType,
      long start,
      long duration,
      int slotId) {
    final boolean isEmergencyNumber = PhoneNumberUtils.isLocalEmergencyNumber(number, mApplication);

    // On some devices, to avoid accidental redialing of
    // emergency numbers, we *never* log emergency calls to
    // the Call Log.  (This behavior is set on a per-product
    // basis, based on carrier requirements.)
    final boolean okToLogEmergencyNumber =
        mApplication.getResources().getBoolean(R.bool.allow_emergency_numbers_in_call_log);

    // Don't log emergency numbers if the device doesn't allow it,
    boolean isOkToLogThisCall = !isEmergencyNumber || okToLogEmergencyNumber;

    if (isOkToLogThisCall) {
      if (DBG) {
        log(
            "sending Calllog entry: "
                + ci
                + ", "
                + PhoneUtils.toLogSafePhoneNumber(number)
                + ","
                + presentation
                + ", "
                + callType
                + ", "
                + start
                + ", "
                + duration);
      }

      /// M: For GEMINI or Other type call(Ex: sip call/video call) @{
      CallLogAsync.AddCallArgs args;
      if (mPhoneType == PhoneConstants.PHONE_TYPE_CDMA && mIsCdmaCallWaitingReject) {
        args =
            getCallArgsForCdmaCallWaitingReject(
                ci, number, presentation, callType, start, duration, slotId);
      } else {
        args = getCallArgs(ci, number, presentation, callType, start, duration, slotId);
      }
      /// @}

      try {
        mCallLog.addCall(args);
      } catch (SQLiteDiskIOException e) {
        // TODO Auto-generated catch block
        Log.e(LOG_TAG, "Error!! - logCall() Disk Full!");
        e.printStackTrace();
      }
    }
    reset();
  }