I think football authorities have needlessly tied themselves in knots over this rule to the point where many games are being ruined.
IMO, a solution would be that for a deliberate handball a penalty be awarded and a yellow card, or red for denying goal scoring chance, be awarded, i.e. as it should be now.
However, if the ball just strikes the arm/ hand of a defender, accidentally, either for a shot towards goal or preventing a cross reaching a teammate, an indirect free kick be awarded to attacking team thus they retain possession and have a chance of either scoring directly with a deflected strike at goal or gain the opportunity to work a goal scoring chance.
And thirdly, for an accidental strike of defender's arm/hand where no advantage is gained there should be no award i.e. play on.
Some may say this makes it more complicated, IMO whatever the award it would make it clear to those watching how the referee has interpreted the handball.