(bug 42940) Better handling of invalid group IDs

* Show a group in the selector only if it's one of
  the recognized groups.
* Fix the API so that it won't add empty strings
  as recent group IDs.

Change-Id: I416274376e53010e61b170eed57684349e4ad8c3