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);

}

}

}

相关推荐
alexhilton2 小时前
在Jetpack Compose中创建CRT屏幕效果
android·kotlin·android jetpack
2501_940094024 小时前
emu系列模拟器最新汉化版 安卓版 怀旧游戏模拟器全集附可运行游戏ROM
android·游戏·安卓·模拟器
下位子4 小时前
『OpenGL学习滤镜相机』- Day9: CameraX 基础集成
android·opengl
参宿四南河三6 小时前
Android Compose SideEffect(副作用)实例加倍详解
android·app
火柴就是我7 小时前
mmkv的 mmap 的理解
android
没有了遇见7 小时前
Android之直播宽高比和相机宽高比不支持后动态获取所支持的宽高比
android
shenshizhong8 小时前
揭开 kotlin 中协程的神秘面纱
android·kotlin
vivo高启强8 小时前
如何简单 hack agp 执行过程中的某个类
android
沐怡旸8 小时前
【底层机制】 Android ION内存分配器深度解析
android·面试
你听得到119 小时前
肝了半个月,我用 Flutter 写了个功能强大的图片编辑器,告别image_cropper
android·前端·flutter