@Aestivate
Imparfait is used in a couple different circumstances, one of them is that you were doing something until you were interrupted by something something else. That's because imparfait is an action that happens over a long period of time or an incomplete one or a feeling or description of something. Pass? compose is used when an action has a clear start and finish like Je suis tomb?, (I fell) the action is done almost immediately and has a clear start and finish whereas a verb like J'aimais (I liked) is a very general action and you can't really tell when or where it started or ended. In a sentence like the one you wrote, you were doing something until something else happened, so the first verb would be imparfait and the action that is interrupting the previous action would be in pass? compos?.
So with
"Je (ecouter) de la musique quand quelqu'un (frapper) a la porte"
it would look like
"J'ecoutais de la musique quand quelqu'un a frapp? a la porte"
"I was listening to music when someone knocked on the door"
Pouvait and avait are the conjugated forms of pouvoir and avoir with the imparfait endings. I'm not sure I understand your question since both of these have no special agreements in imparfait but these two verbs are more commonly in imparfait form rather than pass? compos? because they are more abstract. Simply because logically you don't just start or stop being able to do something with pouvoir and avoir where you're describing something (ex: I have blond hair).
I'm sorry if that was really confusing or way too much info.