I can think of three possibilities. The first is that the rest of the Royal Family and the magnates of Brazil refuse to permit the King to leave Brazil to try to save Portugal from the rebels in 1822 in the first place, fearing that the result will be either rule from Lisbon at the expense of their interests or just what happened--independence without Angola and Mozambique and the rest of the Portuguese Empire. Even if Portugal were lost (and the King was overthrown in Portugal a few years later anyway), it is unlikely that the British would have gone to war with a Brazilian Portuguese Empire that was a fait accompli.
The other possibility that I see is that Brazil and Portugal cede Mozambique to the UK in return for the UK's tolerance of a Brazilian Angola. I suspect that the British were more worried about a Brazilian Mozambique anyway, since Mozambique, particularly Lourenco Marques,(now Maputo, the capital) was very close to the expanding British Cape and Natal colonies. Possibly cession of Macao and/or East Timor and/or Goa would get the British East India Company on board with the idea.
The third possibility is far more recent. A desperate Great Britain is willing to acquiesce to Brazilian takeover of Angola and Mozambique (and possibly the Belgian Congo, tying the two together over Lake Malawi since the King of Belgium collaborated with the Nazis) in return for Brazil joining the Allies in 1940 or 1941 at a time when it appeared impossible to get the United States involved. A move of this sort would require Great Britain to take official notice of Portugal's trade in strategic mercury with the Axis in violation of Portugal's neutrality and declare war on Portugal (and most likely Spain as well) leaving Brazil with the Cape Verde Islands, the Azores and Madiera as well. And while Brazil would not have much of a navy, the United States could help out as the "arsenal of democracy" under Lend-Lease there.