Fix "some user restrictions not working" issue

SettingsProvider used to prevent any changes to certain settings
when the corresponding user restriction is set, which isn't really what
these restrictions mean.
Even if a user restriction is set, it should still changing in the more
restricting direction.

Also stop setting "" to LOCATION_PROVIDERS_ALLOWED, which will simply
be ignored.

Bug 25614198

Change-Id: Ifa8edc2927e21e6c6174620c8c874c86c1dc0f75
diff --git a/services/core/java/com/android/server/pm/UserRestrictionsUtils.java b/services/core/java/com/android/server/pm/UserRestrictionsUtils.java
index 85453a8..77abd3e 100644
--- a/services/core/java/com/android/server/pm/UserRestrictionsUtils.java
+++ b/services/core/java/com/android/server/pm/UserRestrictionsUtils.java
@@ -285,6 +285,10 @@
      * <p>Note this method is called by {@link UserManagerService} while holding
      * {@code mRestrictionLock}. Be aware when calling into other services, which could cause
      * a deadlock.
+     *
+     * <p>See also {@link
+     * com.android.providers.settings.SettingsProvider#isGlobalOrSecureSettingRestrictedForUser},
+     * which should be in sync with this method.
      */
     private static void applyUserRestrictionLR(Context context, int userId, String key,
             boolean newValue) {
@@ -306,7 +310,7 @@
                 case UserManager.DISALLOW_CONFIG_WIFI:
                     if (newValue) {
                         android.provider.Settings.Secure.putIntForUser(cr,
-                                android.provider.Settings.Secure
+                                android.provider.Settings.Global
                                         .WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON, 0, userId);
                     }
                     break;
@@ -316,9 +320,6 @@
                                 android.provider.Settings.Secure.LOCATION_MODE,
                                 android.provider.Settings.Secure.LOCATION_MODE_OFF,
                                 userId);
-                        android.provider.Settings.Secure.putStringForUser(cr,
-                                android.provider.Settings.Secure.LOCATION_PROVIDERS_ALLOWED, "",
-                                userId);
                     }
                     // Send out notifications as some clients may want to reread the
                     // value which actually changed due to a restriction having been