应用可以通过控制通知的条数来控制通知圆点的个数显示,例如未接电话在电话应用中将通知限制成8条,故在Launcher中未读小圆点及条数最多只能显示8(但是由于广播发送延迟,会先显示9,被应用remove后又马上变为8),如需修改最大条数限制,则需要对应模块的app对其条数限制进行修改。
launcher相关逻辑:src/com/android/launcher3/dot/DotInfo.java
public boolean addOrUpdateNotificationKey(NotificationKeyData notificationKey) {
int indexOfPrevKey = mNotificationKeys.indexOf(notificationKey);
NotificationKeyData prevKey = indexOfPrevKey == -1 ? null
: mNotificationKeys.get(indexOfPrevKey);
if (prevKey != null) {
if (prevKey.count == notificationKey.count) {
return false;
}
// Notification was updated with a new count.
mTotalCount -= prevKey.count;
mTotalCount += notificationKey.count;
prevKey.count = notificationKey.count;
return true;
}
boolean added = mNotificationKeys.add(notificationKey);
if (added) {
mTotalCount += notificationKey.count; //圆点显示个数
}
return added;
}
展锐android launcher通知圆点的个数显示
于 2023-07-13 14:03:35 首次发布
应用通过限制通知的条数来影响Launcher中未读圆点显示,如电话应用设为8条上限。由于广播发送延迟,可能会短暂显示9条,随后调整回8条。若要改变限制,需在对应模块的app内修改。Launcher的相关逻辑在DotInfo.java文件中管理,包括添加、更新通知键以及计算总数量。

1802

被折叠的 条评论
为什么被折叠?



