Roof to wall flashing / kickout

I’ve fixed a hole in our stucco near the edge of the roof but I’m wondering if this flashing is done correctly?

Above the brown step flashing there is the white flashing and if I lift that up there seems to be galvanized z-flashing under that. How should this meet up against the stucco prior to the window?

With the hole in the picture filled in, if I put water on the wall above the roof it runs down onto the white flashing and seems to go into the groove where it meets the stucco. It then runs down to the very end where I think it ends up behind the kickout flashing as I can see it running out between the roof and the wall.

That is a pretty dangerous spot for a window. That must be an addition?
The flashing here is not correct, but it is common on reroofs because of the cost or knowledge needed to do it right. When first done the stucco ran down right over the flashings. When reroofed and flashing needed to be replaced it is likely they cut the stucco and flashed it with step flashing and the slid this white metal under the stucco to cover over the flashing.
Which wouldn’t of been too bad until they got to the window and brought it out instead of a kick out diverted. Water can still run behind that flashing and get inside.
The way I would have done it is started with a dry flekt diverter and flashed it up the rest of the way with step flashings. Then the a trim board in with a z flashing on top tucked under the stucco. This would push all the water out. Or if you didn’t want to change your look you could re stucco down over the flashings.
Hope this helps!

Hmm can the window even be opened?