Android 开关机(重启)时让充电指示灯一直亮起,不灭

frameworks/base/services/core/java/com/android/server/notification/NotificationManagerService.java

首先排查这个类,但发现没有去关闭充电指示灯的操作和代码逻辑。

于是想着其他地方会不会有关闭充电指示灯的地方。

除了充电灯,闪灯,那就是通知灯了,果然,皇天不负有心人

frameworks/base/services/core/java/com/android/server/notification/NotificationManagerService.java

判断为开机默认正常使用灯光,

//*add, charging light stays on when power on or restart phone
private boolean isFirstOff = true;
//*/

@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) { //res:Notification Light turnOff mBatteryLight

mNotificationLight.turnOff();//当通知为空或亮屏时关掉的通知灯 == 充电灯

//*/add,charging light stays on when power on or restart phone
if (isFirstOff) {
isFirstOff = false;
BatteryService.updateNotificationLights(true);
}
BatteryService.updateNotificationLights(false);
//*/

} else {

NotificationRecord.Light light = ledNotification.getLight();

if (light != null && mNotificationPulseEnabled) {

// pulse repeatedly

mNotificationLight.setFlashing(light.color, LogicalLight.LIGHT_FLASH_TIMED,

light.onMs, light.offMs);

}

}

}

相关推荐
音视频牛哥2 小时前
大牛直播SDK(SmartMediaKit)Android平台Unity3D RTSP/RTMP播放器集成实践
android·unity3d·rtsp播放器·rtmp播放器·unity3d rtmp播放器·安卓unity rtsp播放器·安卓unity rtmp播放器
w1wi2 小时前
安卓抓包完全指南(一):从入门到 SSL Pinning 绕过
android·网络协议·ssl
aqi003 小时前
一文理清 HarmonyOS 6.0.2 涵盖的十个升级点
android·华为·harmonyos·鸿蒙·harmony
赏金术士4 小时前
Jetpack Compose 状态提升(State Hoisting)完全指南
android·kotlin·compose
BoomHe5 小时前
git Rebase 为任意一笔提交补上 Change-Id
android·git·android studio
TDengine (老段)5 小时前
TDengine 超级表/子表/普通表 — 设计理念与内部表示
android·大数据·数据库·物联网·时序数据库·tdengine·涛思数据
shuaiqinke5 小时前
【分享】Edge浏览器|内置扩展仓库|支持油猴|上网无限制
android·前端·人工智能·edge
Carson带你学Android6 小时前
见证历史!Swift 6.3 官方支持 Android,跨平台要变天了?
android
plainGeekDev7 小时前
Android性能优化面试题:你说你会优化,结果连ANR都排查不了
android·面试