Add support for setting global preferences via API
Bug: T323076 Change-Id: If703153aa96c257725bdafa81fc76870a59bfced