This is a California Jim type question; however, my effort:
had been doing (PPP) -- used when there is a necessity to make clear or stress that the continuous action was already in well in progress when the second past event occurred: 'I had been polishing my car for half an hour when the flock of birds flew over.'
was doing (PP) -- used when the action is background action to
Past progressive represents an activity taking place prior to the present, i.e., prior to the moment of speaking.
Past Perfect Progressive represents an activity taking place prior to the past, i.e., prior to some moment in the past (usually mentioned in the same conversation or even in the same utterance).