Technically, there were two albums: one for Two Seas, and one as an independent artist.
Michael was infrequently working on material from 2005-06, but it was clear to everyone in his inner circle that he wasn't yet far enough removed from the trial to be fully committed to his Two Seas contract, which he basically reneged by fleeing Bahrain in summer 2006. By the time he started working with will.i.am that fall, the slate was more or less clean. It's worth noting that Michael stopped working on every song that originated in Bahrain after he left (other than "I Have This Dream," but even that was rewritten as "Bottom of My Heart"). I don't think we would've ever heard any of that material had Michael lived to finish the album, especially considering the Prince Abdullah fallout.
Will.i.am was one of the contributors to the "independent album," which (technically) began in September 2006. The production process was fundamentally the same as every album from Dangerous onward: a variety of songwriters and producers would contribute material, from which the final track list would be assembled. This time around, Michael spent time in the studio with will.i.am, RedOne, Akon, Neff-U, and Brad Buxer, and was still taking and making calls with potential contributors, both old and new. Production slowed once This Is It kicked into gear, but Michael was recording vocals as late as the week of his passing.