The participial phrase is a modifier. You can argue whether it's adverbial (modifying the action) or adjectival (modifying the actor); but either way your final analysis is correct, since A does it when/while knowing. That is, you could say, "A, while knowing, does it," or you...