问题描述:android framework中修改代码,每次屏幕亮度发生变化的时候发送广播,发送广播使用如下代码进行发送:
Intent intent = new Intent();
intent.setAction("com.android.server.light.brightness");
intent.putExtra("brightness", brightness);
//send broadcast
mContext.sendBroadcast(intent);
运行后logcat打印如下错误信息:
Calling a method in the system process without a qualified user: android.app.ContextImpl.sendBroadcast:966 com.android.server.lights.LightsService$LightImpl.setBrightness:63 com.android.server.display.LocalDisplayAdapter$LocalDisplayDevice$1.setDisplayBrightness:534 com.android.server.display.LocalDisplayAdapter$LocalDisplayDevice$1.run:488 com.android.server.display.DisplayManagerService.requestGlobalDisplayStateInternal:478
解决方法:参考以下博客;
https://blog.csdn.net/jdsjlzx/article/details/38779355
大概意思就是