debug_defconfig
新增:触发闪烁指示灯的关键宏控
CONFIG_LEDS_TRIGGER_TIMER=y
defconfig
新增:触发闪烁指示灯的关键宏控
CONFIG_LEDS_TRIGGER_TIMER=y
device/mediatek/mt6765/init.mt6765.rc +【关键节点】
#add flash leds
chmod 0664 /sys/class/leds/red/delay_on
chown system system /sys/class/leds/red/delay_on
chmod 0664 /sys/class/leds/red/delay_off
chown system system /sys/class/leds/red/delay_off
chmod 0664 /sys/class/leds/blue/delay_on
chown system system /sys/class/leds/blue/delay_on
chmod 0664 /sys/class/leds/blue/delay_off
chown system system /sys/class/leds/blue/delay_off
/frameworks/base/services/core/java/com/android/server/notification/NotificationManagerService.java
} else if (action.equals(Intent.ACTION_USER_PRESENT)) {//解锁状态中
/*if (mNotificationLight != null) {
mNotificationLight.turnOff();
}*/NotificationRecord ledNotification = null;
if(ledNotification != null){mNotificationLight.setFlashing(0xff0000ff, LogicalLight.LIGHT_FLASH_TIMED,500, 500);
}
}
================================当有未读通知,闪烁蓝灯指示灯
@GuardedBy("mNotificationLock")
void updateLightsLocked()
{
if (mNotificationLight == null) {
return;
}// handle notification lights
NotificationRecord ledNotification = null;
while (ledNotification == null && !mLights.isEmpty()) {
final String owner = mLights.get(mLights.size() - 1);
ledNotification = mNotificationsByKey.get(owner);
if (ledNotification == null) {
Slog.wtfStack(TAG, "LED Notification does not exist: " + owner);
mLights.remove(owner);
}
}// Don't flash while we are in a call or screen is on
if (ledNotification == null || isInCall() /*|| mScreenOn*/) {
mNotificationLight.turnOff();
BatteryService.updateNotificationLights(false);//open battery light
} else if (ledNotification != null /*&& !mScreenOn*/ ) {
NotificationRecord.Light light = ledNotification.getLight();
if (light != null && mNotificationPulseEnabled ) {
//*/ close battery light & set notification flash light
BatteryService.updateNotificationLights(true);
//mNotificationLight.setColor(0xff0000ff);
//*/
mNotificationLight.setFlashing(0xff0000ff, LogicalLight.LIGHT_FLASH_TIMED,
500, 500);
Log.d("HD","---------setFlashing-------------");
//*/
}}
}