(bug 42148) Saving the preferences only if they changed

Change-Id: I46a6fa85bc5ebfe6f34a957c302b1bf997cb3576