Yes, he wrote for the majority.
It was very savvy of Chief Justice Roberts to assign the opinion to Kennedy. That move probably ensured Kennedy’s vote (Kennedy has always needed considerable courting from colleagues).