[Xperia Z1 Compact Android Development] foresto:
Screen wake is very slow

Yes, there are several possibly-relevant quotes in the logs, including:

Long monitor contention

Dispatch took 1035ms

Skipped 60 frames

Unblocked screen on after 1082 ms

Screen on took 1264 ms

To test, I put the phone in airplane mode, put it to sleep, waited a few minutes, and then woke it up with a single power button press. Here's the logcat of all buffers, from just before I woke the phone until just after the screen was lit and painted. I added a single '.' on its own line at a couple of points where there were significant delays between log messages; I don't know if those are related to the delayed screen wake, though.

--------- beginning of main

02-16 20:45:57.223 310 454 I qdhwcomposer: handle_blank_event: dpy:0 panel power state: 0

02-16 20:45:57.223 310 454 I qdhwcomposer: handle_blank_event: dpy:1 panel power state: 0

02-16 20:45:57.223 331 520 I qdhwcomposer: handle_blank_event: dpy:0 panel power state: 0

02-16 20:45:57.223 331 520 I qdhwcomposer: handle_blank_event: dpy:1 panel power state: 0

--------- beginning of events

02-16 20:45:57.228 2717 4111 I sysui_histogram: [power_consecutive_short_tap_count,1]

02-16 20:45:57.228 2717 4111 I sysui_multi_action: [757,804,799,power_consecutive_short_tap_count,801,1,802,1]

02-16 20:45:57.228 2717 4111 I sysui_histogram: [power_double_tap_interval,27868]

02-16 20:45:57.228 2717 4111 I sysui_multi_action: [757,804,799,power_double_tap_interval,801,27868,802,1]

--------- beginning of system

02-16 20:45:57.231 2717 4111 I PowerManagerService: Waking up from dozing (uid=1000 reason=android.policy:POWER)...

02-16 20:45:57.233 2717 2717 I screen_toggled: 1

02-16 20:45:57.233 2717 2717 I power_screen_broadcast_send: 1

02-16 20:45:57.235 318 318 E QCOM PowerHAL: Failed to acquire lock.

02-16 20:45:57.238 2717 4111 E LightsService: Light requested not available on this device. 2

02-16 20:45:57.275 2717 5813 I sysui_view_visibility: [127,100]

02-16 20:45:57.275 2717 5813 I sysui_multi_action: [757,127,758,1]

02-16 20:45:57.275 2717 5813 I sysui_histogram: [note_load,1]

02-16 20:45:57.275 2717 5813 I sysui_multi_action: [757,804,799,note_load,801,1,802,1]

02-16 20:45:57.275 2717 5813 I notification_panel_revealed: 1

02-16 20:45:57.278 5584 5584 D StatusBar: disable<e i A s b H R c S q >

02-16 20:45:57.296 5584 5584 I chatty : uid=10029(com.android.systemui) identical 2 lines

02-16 20:45:57.296 5584 5584 D StatusBar: disable<e i A s b H R c S q >

--------- beginning of kernel

02-16 20:45:57.313 0 0 I PM : suspend exit 2019-02-17 04:45:57.313932789 UTC

02-16 20:45:57.326 2620 2714 D audio_hw_primary: adev_set_parameters: enter: screen_state=on

02-16 20:45:57.327 2717 2717 I device_idle: [0,screen]

02-16 20:45:57.327 2717 2717 I device_idle_light: [0,screen]

02-16 20:45:57.328 2717 2751 I device_idle_off_start: screen

02-16 20:45:57.337 2717 3183 I DisplayPowerController: Blocking screen on until initial contents have been drawn.

02-16 20:45:57.369 2717 2751 I device_idle_off_phase: net

02-16 20:45:57.370 2717 2751 I device_idle_off_complete:

--------- beginning of radio

02-16 20:45:57.387 5724 5724 D DCT : [0]screen on

02-16 20:45:57.387 5724 5724 D DCT : [0]stopNetStatPoll

02-16 20:45:57.391 6967 6967 D NFCJNI : com_android_nfc_NfcManager_doSetScreenState: screen_state_mask = 4

02-16 20:45:57.395 2717 2717 I power_screen_broadcast_done: [1,162,1]

.

02-16 20:45:57.797 2717 6945 I sysui_multi_action: [757,128,758,1,793,3906598,794,0,795,3906598,796,89,798,0,806,android,857,TrustInterface,858,4,947,0]

02-16 20:45:57.797 2717 6945 I sysui_histogram: [note_freshness,3906598]

02-16 20:45:57.797 2717 6945 I sysui_multi_action: [757,804,799,note_freshness,801,3906598,802,1]

02-16 20:45:57.797 2717 6945 I notification_visibility: [0|android|89|null|1000,1,3906598,3906598,0,0]

02-16 20:45:57.845 331 520 I qdhwcomposer: handle_blank_event: dpy:0 panel power state: 1

02-16 20:45:57.845 310 454 I qdhwcomposer: handle_blank_event: dpy:0 panel power state: 1

.

02-16 20:45:58.344 319 1281 E qti_sensors_hal: waitForResponse: pthread_cond_timedwait() rc=110 (cond: 0)

02-16 20:45:58.345 319 1281 E qti_sensors_hal: timeServiceStart: ERROR: No response from request 2

02-16 20:45:58.347 319 1281 W hw-IPCThreadState: All binder threads in pool (2 threads) busy for 1004 ms

02-16 20:45:58.353 2717 2763 I DisplayManagerService: Display device changed state: "Built-in Screen", ON

02-16 20:45:58.357 331 331 D SurfaceFlinger: Set power mode=2, type=0 flinger=0xb4750000

02-16 20:45:58.357 331 331 D qdhwcomposer: hwc_setPowerMode: Setting mode 2 on display: 0

02-16 20:45:58.357 331 331 D qdhwcomposer: hwc_setPowerMode: Done setting mode 2 on display 0

02-16 20:45:58.357 310 454 I qdhwcomposer: handle_blank_event: dpy:0 panel power state: 1

02-16 20:45:58.358 331 520 I qdhwcomposer: handle_blank_event: dpy:0 panel power state: 1

02-16 20:45:58.402 5724 5724 D RILJ : [4003]> RIL_REQUEST_SEND_DEVICE_STATE 2:false [SUB0]

02-16 20:45:58.402 2643 2643 D RILC : sendDeviceState: calling screen state 1

02-16 20:45:58.403 5724 6214 D RILJ : [4003]< RIL_REQUEST_SEND_DEVICE_STATE [SUB0]

02-16 20:45:58.407 5724 5724 D RILJ : [4004]> RIL_REQUEST_SET_UNSOLICITED_RESPONSE_FILTER 7 [SUB0]

02-16 20:45:58.408 5724 6214 D RILJ : [4004]< RIL_REQUEST_SET_UNSOLICITED_RESPONSE_FILTER error 6 [SUB0]

02-16 20:45:58.408 5724 6214 D RilRequest: [4004]< RIL_REQUEST_SET_UNSOLICITED_RESPONSE_FILTER error: com.android.internal.telephony.CommandException: REQUEST_NOT_SUPPORTED ret=

02-16 20:45:58.416 2717 3761 W zygote : Long monitor contention with owner android.ui (2754) at void com.android.server.policy.PhoneWindowManager.finishScreenTurningOn()(PhoneWindowManager.java:7609) waiters=0 in boolean com.android.server.policy.PhoneWindowManager.isScreenOn() for 1.025s

02-16 20:45:58.416 2717 3761 I dvm_lock_sample: [system_server,1,android.anim,1025,PhoneWindowManager.java,7677,boolean com.android.server.policy.PhoneWindowManager.isScreenOn(),-,7609,void com.android.server.policy.PhoneWindowManager.finishScreenTurningOn(),100]

02-16 20:45:58.417 2717 2754 W Looper : Dispatch took 1035ms on android.ui, h=Handler (com.android.server.policy.PhoneWindowManager$PolicyHandler) {95f019a} cb=null msg=7

02-16 20:45:58.417 2717 3761 I Choreographer: Skipped 60 frames! The application may be doing too much work on its main thread.

02-16 20:45:58.419 2717 3183 I DisplayPowerController: Unblocked screen on after 1082 ms

02-16 20:45:58.420 2717 3183 I sysui_multi_action: [757,198,758,1,759,0,793,1264]

02-16 20:45:58.420 2717 3183 I power_screen_state: [1,0,0,0,1264]

02-16 20:45:58.420 2717 3183 W PowerManagerService: Screen on took 1264 ms

02-16 20:45:58.421 2717 3183 I DreamManagerService: Gently waking up from dream.

02-16 20:45:58.421 2717 2761 I DreamManagerService: Performing gentle wake from dream.

02-16 20:45:58.429 2717 4111 I InputReader: Reconfiguring input devices. changes=0x00000004

02-16 20:45:58.444 2717 6945 I DreamManagerService: Leaving dreamland.

02-16 20:45:58.444 2717 2761 I DreamManagerService: Performing gentle wake from dream.

02-16 20:45:58.444 2717 2761 I DreamController: Stopping dream: name=ComponentInfo{com.android.systemui/com.android.systemui.doze.DozeService}, isTest=false, canDoze=true, userId=0

02-16 20:45:58.444 2717 2761 I sysui_view_visibility: [223,0]

02-16 20:45:58.444 2717 2761 I sysui_multi_action: [757,223,758,2]

02-16 20:45:58.444 2717 2761 I sysui_histogram: [dozing_minutes,10]

02-16 20:45:58.445 2717 2761 I sysui_multi_action: [757,804,799,dozing_minutes,801,10,802,1]

.

02-16 20:45:58.742 318 318 E QCOM PowerHAL: Failed to acquire lock.