android waklock锁阻止休眠调试

上层wakelock 锁获取

 adb shell dumpsys power
 
Looper state:
  Looper (PowerManagerService, tid 30) {aabc9c2}
    Message 0: { when=+42s654ms what=4 target=com.android.server.power.PowerManagerService$PowerManagerHandler }
    Message 1: { when=+9m39s94ms what=1 target=com.android.server.power.PowerManagerService$PowerManagerHandler }
    (Total messages: 2, polling=true, quitting=false)

Wake Locks: size=1
  PARTIAL_WAKE_LOCK              '*alarm*' ACQ=-1s541ms (uid=1000 pid=29334 ws=WorkSource{10033})

Suspend Blockers: size=4
  PowerManagerService.WakeLocks: ref count=1
  PowerManagerService.Display: ref count=1
  PowerManagerService.Broadcasts: ref count=0
  PowerManagerService.WirelessChargerDetector: ref count=0

Display Power: state=ON

如何去除上层java wakelock

   private void acquireWakeLockInternal(IBinder lock, int flags, String tag, String packageName,
            WorkSource ws, String historyTag, int uid, int pid) {
        //add this line
        if (true) return;
        synchronized (mLock) {
            if (DEBUG_SPEW) {
                Slog.d(TAG, "acquireWakeLockInternal: lock=" + Objects.hashCode(lock)
                        + ", flags=0x" + Integer.toHexString(flags)
                        + ", tag=\"" + tag + "\", ws=" + ws + ", uid=" + uid + ", pid=" + pid);
            }

            WakeLock wakeLock;
            int index = findWakeLockIndexLocked(lock);
            boolean notifyAcquire;

在PowerManagerService.java 函数acquireWakeLockInternal 中添加
if (true) return;
可以去除上层java锁。

如何去除cpp c java wakelock

android waklock锁阻止休眠调试_第1张图片
尝试在system/core suspend 模块去除。

kernel wakelock 锁获取

cat /sys/kernel/debug/wakeup_sources
android waklock锁阻止休眠调试_第2张图片

部分串口调试指令

echo "peripheral" > /sys/devices/platform/soc/4e00000.ssusb/mode //devices模式,不会休眠
echo 1 >/proc/sysrq-trigger                                       //串口等级1
cat /sys/power/system_sleep/stats                                //查看rpm是否进低功耗模式
cat /d/rpm_master_stats                                           //查看哪个子系统是否休眠
echo 1 > /d/clk/debug_suspend && echo 1 > /sys/module/msm_show_resume_irq/parameters/debug_mask && echo 8 > /proc/sys/kernel/printk  //打开时钟调试,中断调试,串口等级最大
echo "host" > /sys/devices/platform/soc/4e00000.ssusb/mode        //host模式,会休眠

nohup logcat -v time > /data/local/tmp/logcat.txt &                  //将logcat日志打到后台

你可能感兴趣的:(android)