Don't update user's setup state unless it changed

Eliminates an extra write on every boot.

Bug: 16416936
Change-Id: I9ca16676c1b39dafeed3fc744a69c5bde819990c
diff --git a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
index e0612eb..dc55e6d 100644
--- a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
+++ b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
@@ -4291,9 +4291,11 @@
             if (Settings.Secure.getIntForUser(resolver, Settings.Secure.USER_SETUP_COMPLETE, 0,
                     userHandle) != 0) {
                 DevicePolicyData policy = getUserData(userHandle);
-                policy.mUserSetupComplete = true;
-                synchronized (this) {
-                    saveSettingsLocked(userHandle);
+                if (!policy.mUserSetupComplete) {
+                    policy.mUserSetupComplete = true;
+                    synchronized (this) {
+                        saveSettingsLocked(userHandle);
+                    }
                 }
             }
         }