Refactor multi-profile code

Consolidate the redundant preference checks and switch statements into
G.java.  Revert back to the Default profile when multi-profile is
disabled.  Fix a couple of instances where the active profile UID lists
got out of sync with the current profile selection.