Prevents users from being added if device is not provisioned

Also added a utility function for checking provisioning, instead of
repeating code for this check in several places.

bug:26156445
Change-Id: I9f4a280dd0cdf889f892e386dbf6a3fdb2a052ef
diff --git a/src/com/android/settings/MasterClearConfirm.java b/src/com/android/settings/MasterClearConfirm.java
index 7c14bad..77e283e 100644
--- a/src/com/android/settings/MasterClearConfirm.java
+++ b/src/com/android/settings/MasterClearConfirm.java
@@ -68,8 +68,7 @@
                     getActivity().getSystemService(Context.PERSISTENT_DATA_BLOCK_SERVICE);
 
             if (pdbManager != null && !pdbManager.getOemUnlockEnabled() &&
-                    Settings.Global.getInt(getActivity().getContentResolver(),
-                            Settings.Global.DEVICE_PROVISIONED, 0) != 0) {
+                    Utils.isDeviceProvisioned(getActivity())) {
                 // if OEM unlock is enabled, this will be wiped during FR process. If disabled, it
                 // will be wiped here, unless the device is still being provisioned, in which case
                 // the persistent data block will be preserved.