Automakers are stockpiling patents amid an industry transformation, building up portfolios on technologies for self-driving and connected cars, but attorneys say the companies — perhaps with lessons from the smartphone wars…