多条未接来电只显示来电数,同时拨号应用通知小圆点一直显示

本文介绍了一种改进的手机未接来电通知实现方案。通过调整Telecomm与Dialer应用间的交互逻辑,确保当未接来电数量达到特定阈值时,能够更准确地展示通知,并在必要时清除原有通知图标。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

1、修改vendor/mediatek/proprietary/packages/services/Telecomm/src/com/android/server/telecom/ui/MissedCallNotifierImpl.java函数shouldManageNotificationThroughDefaultDialer让其不通知dialer,由telecom调用NotificationManager 显示来电条数,此方法dialer  app右上角不会显示通知圆点

2、通知dialer进行通知,NOTIFICATION_COUNT_MAX超过会显示条数但会清除圆点。

vendor/mediatek/proprietary/packages/apps/Dialer/java/com/android/dialer/app/calllog/MissedCallNotifier.java

    if (useCallList && count <= NOTIFICATION_COUNT_MAX) {
      LogUtil.i("MissedCallNotifier.useCallList:", "begin");
      // Do not repost active notifications to prevent erasing post call notes.
      NotificationManager manager = getNotificationMgr();
      Set<String> activeTags = new ArraySet<>();
      for (StatusBarNotification activeNotification : manager.getActiveNotifications()) {
        LogUtil.i("MissedCallNotifier.activeNotification.getTag():", activeNotification.getTag());
        activeTags.add(activeNotification.getTag());
      }
      LogUtil.i("MissedCallNotifier.useCallList:", "end");
 
      for (NewCall call : newCalls) {
        String callTag = getNotificationTagForCall(call);
        if (!activeTags.contains(callTag)) {
          LogUtil.i("MissedCallNotifier !activeTags.contains(callTag)", callTag);
          //manager.notify(callTag, NOTIFICATION_ID, getNotificationForCall(call, null));
          manager.notify(callTag, NOTIFICATION_ID, getNotificationForCall_Ext(call, count, context));
        }
      }
    }

    if (useCallList && count > NOTIFICATION_COUNT_MAX) {
        LogUtil.i("MissedCallNotifier.updateMissedCallNotification", "count > 5, clear miss call");
        cancelAllMissedCallNotifications(context);
    }

3、最后修改updateMissedCallNotification函数中

    //rex add start
    /*
    if (useCallList && count > NOTIFICATION_COUNT_MAX) {
        LogUtil.i("MissedCallNotifier.updateMissedCallNotification", "count > 5, clear miss call");
        cancelAllMissedCallNotifications(context);
    }*/
    //rex add end
...............................
    //rex add start
    groupSummary
        .setContentTitle(context.getText(titleResId))
        .setContentText(expandedText)
        .setContentIntent(createCallLogPendingIntent())
        .setDeleteIntent(
            CallLogNotificationsService.createCancelAllMissedCallsPendingIntent(context))
        //.setGroupSummary(useCallList)
        //.setOnlyAlertOnce(useCallList)
        .setPublicVersion(publicSummaryBuilder.build());
    //rex add end
............................
    //rex add start
    /*
    if (useCallList && count <= NOTIFICATION_COUNT_MAX) {
      LogUtil.i("MissedCallNotifier.useCallList:", "begin");
      // Do not repost active notifications to prevent erasing post call notes.
      NotificationManager manager = getNotificationMgr();
      Set<String> activeTags = new ArraySet<>();
      for (StatusBarNotification activeNotification : manager.getActiveNotifications()) {
        LogUtil.i("MissedCallNotifier.activeNotification.getTag():", activeNotification.getTag());
        activeTags.add(activeNotification.getTag());
      }
      LogUtil.i("MissedCallNotifier.useCallList:", "end");

      for (NewCall call : newCalls) {
        String callTag = getNotificationTagForCall(call);
        if (!activeTags.contains(callTag)) {
          LogUtil.i("MissedCallNotifier !activeTags.contains(callTag)", callTag);
          manager.notify(callTag, NOTIFICATION_ID, getNotificationForCall(call, null));
        }
      }
    }*/
    //rex add end

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值