Apple obviously writes its own software for the iPhone, but Samsung's phones all run a customized version of Google's open-source Android, and Samsung is so dominant that it could very wellsplit off and start building its own version of Android, just as Amazon did with the Kindle Fire.
Assuming the expense allocation was reflective of how they would ultimatly split the money, the bottom line effect that it had could have been achieved with a well drafted partnership agreement.