需求:只有来短信、未接电话呼吸灯才闪烁提示,其他应用的未读通知呼吸灯不闪烁提示。
实现:
frameworks/base/services/core/java/com/android/server/notification/NotificationManagerService.java
public class NotificationManagerService extends SystemService {
} else {
NotificationRecord.Light light = ledNotification.getLight();
+ String pkg = ledNotification.getSbn().getPackageName();
+ boolean isBreathinglight = false;
+ if (pkg.equals("com.android.dialer")
+ || pkg.equals("com.android.mms")
+ || pkg.equals("com.google.android.dialer")
+ || pkg.equals("com.google.android.apps.messaging")) {
+ isBreathinglight = true;
}
+ if (light != null && mNotificationPulseEnabled && isBreathinglight) {
在NotificationManagerService.java的updateLightsLocked()方法下面的逻辑就是去开启未读消息呼吸灯的,在前面的判断加上自己需要屏蔽的逻辑即可。
mNotificationLight.setFlashing(light.color, LogicalLight.LIGHT_FLASH_TIMED,light.onMs, light.offMs);
完成。
3411

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



