Settings: clean up the cursor leaks

This should provide safer code so that cursors will not be created more than once in
any instance where they already existed. There were 10 cursor leaks fixed.

PS2: fixup brackets and some cleanup
PS3: reflect a change to ApnSettings that was recently merged

Change-Id: I7dd1a224b07f151746d9ffc87207904b4bef5412