DisplayPowerState

源码:

  base\services\core\java\com\android\server\display\DisplayPowerState.java

功能:

  对LightsService封装了一层

  对上:提供mProperty.setValue方法

  对下:调用LightsService.setBrightness方法,设置brightness

源码分析:

  构建了mProperty.setValue这个方法供调用,传入brightness值

public static final IntProperty<DisplayPowerState> SCREEN_BRIGHTNESS =
        new IntProperty<DisplayPowerState>("screenBrightness") {
    public void setValue(DisplayPowerState object, int value)
        object.setScreenBrightness(value);    // DisplayPowerState.setScreenBrightness
            mScreenBrightness = brightness;
            scheduleScreenUpdate();
                postScreenUpdateThreadSafe();
                    mHandler.post(mScreenUpdateRunnable);    // 执行mScreenUpdateRunnable.run()
                        brightness = mScreenBrightness;
                        mPhotonicModulator.setState(mScreenState, brightness);
                            mPendingBacklight = backlight;    // brightness最终保存在PhotonicModulator.mPendingBacklight
                            mLock.notifyAll();    // 唤醒PhotonicModulator线程

notifyAll将唤醒PhotonicModulator线程,最终调用LightsService.setBrightness,请查看LightsService

public void run() {
    for (;;) {
        backlight = mPendingBacklight;
        backlightChanged = (backlight != mActualBacklight);
        if (!stateChanged && !backlightChanged) {
               mLock.wait();    // 等待
            continue;
        }
        mActualBacklight = backlight;    // 更新数据

        if (backlightChanged)
            setBrightness(backlight);
                mBacklight.setBrightness(backlight);    // mLights[LIGHT_ID_BACKLIGHT].setBrightness(backlight)
    }
}

转载于:https://www.cnblogs.com/zzss-feature/p/8302629.html

PMS卡waitForFreeSlotThenRelock, 01-03 16:01:44.084 1977 2028 I watchdog: Blocked in handler on on PowerManagerService (PowerManagerService) for 255s ----- pid 1977 at 2025-01-03 16:01:46.518707239+0800 ----- ----- pid 1977 at 2025-01-03 16:01:17.554954006+0800 ----- Cmd line: system_server "PowerManagerService" prio=5 tid=56 Native | group="main" sCount=1 ucsCount=0 flags=1 obj=0x17ec4500 self=0xb4000079c1033c00 | sysTid=2062 nice=-4 cgrp=default sched=1073741824/0 handle=0x79b4375cb0 | state=S schedstat=( 351856732704 976659657815 2400583 ) utm=19914 stm=15271 core=4 HZ=100 | stack=0x79b4272000-0x79b4274000 stackSize=1039KB | held mutexes= native: #00 pc 00099cd0 /apex/com.android.runtime/lib64/bionic/libc.so (syscall+32) (BuildId: a87e89fc2c0a5753053f536add4d7ae1) native: #01 pc 0009eba0 /apex/com.android.runtime/lib64/bionic/libc.so (__futex_wait_ex+144) (BuildId: a87e89fc2c0a5753053f536add4d7ae1) native: #02 pc 0010add8 /apex/com.android.runtime/lib64/bionic/libc.so (pthread_cond_timedwait+136) (BuildId: a87e89fc2c0a5753053f536add4d7ae1) native: #03 pc 0005c78c /system/lib64/libc++.so (std::__1::condition_variable::__do_timed_wait+108) (BuildId: bc850c2b884ffd2f060de392e1cf9d7a) native: #04 pc 0009d414 /system/lib64/libgui.so (android::BufferQueueProducer::waitForFreeSlotThenRelock const::$_0::operator const +244) (BuildId: 92838486b30c1ed724da633dd9e7f7aa) native: #05 pc 0009d250 /system/lib64/libgui.so (android::BufferQueueProducer::waitForFreeSlotThenRelock const+1520) (BuildId: 92838486b30c1ed724da633dd9e7f7aa) native: #06 pc 0009d784 /system/lib64/libgui.so (android::BufferQueueProducer::dequeueBuffer+580) (BuildId: 92838486b30c1ed724da633dd9e7f7aa) native: #07 pc 00101280 /system/lib64/libgui.so (android::Surface::dequeueBuffer+1120) (BuildId: 92838486b30c1ed724da633dd9e7f7aa) native: #08 pc 00784fa4 /vendor/lib64/egl/libGLES_mali.so (???) (BuildId: d3277e93432b1bfc) native: #09 pc 0079b798 /vendor/lib64/egl/libGLES_mali.so (???) (BuildId: d3277e93432b1bfc) native: #10 pc 0079b4f4 /vendor/lib64/egl/libGLES_mali.so (???) (BuildId: d3277e93432b1bfc) native: #11 pc 00701f90 /vendor/lib64/egl/libGLES_mali.so (???) (BuildId: d3277e93432b1bfc) native: #12 pc 0076186c /vendor/lib64/egl/libGLES_mali.so (???) (BuildId: d3277e93432b1bfc) native: #13 pc 00700dfc /vendor/lib64/egl/libGLES_mali.so (???) (BuildId: d3277e93432b1bfc) native: #14 pc 006ff4d8 /vendor/lib64/egl/libGLES_mali.so (???) (BuildId: d3277e93432b1bfc) native: #15 pc 006f6cb8 /vendor/lib64/egl/libGLES_mali.so (glClear+116) (BuildId: d3277e93432b1bfc) at android.opengl.GLES20.glClear(Native method) at com.android.server.display.ColorFade.draw(ColorFade.java:470) at com.android.server.display.DisplayPowerState$5.run(DisplayPowerState.java:502) at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1544) at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1553) at android.view.Choreographer.doCallbacks(Choreographer.java:1109) at android.view.Choreographer.doFrame(Choreographer.java:994) at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:1527) at android.os.Handler.handleCallback(Handler.java:958) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loopOnce(Looper.java:257) at android.os.Looper.loop(Looper.java:368) at android.os.HandlerThread.run(HandlerThread.java:67) at com.android.server.ServiceThread.run(ServiceThread.java:46)
最新发布
04-05
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值