Added check of the restriction if a user is allowed to change their icon.
BUG: 25305966

Change-Id: I35fda2e4f157463d69a109409c3f8767d54eab4a
diff --git a/src/com/android/settings/users/EditUserPhotoController.java b/src/com/android/settings/users/EditUserPhotoController.java
index 1ca6928..0d327a0 100644
--- a/src/com/android/settings/users/EditUserPhotoController.java
+++ b/src/com/android/settings/users/EditUserPhotoController.java
@@ -32,6 +32,7 @@
 import android.graphics.drawable.Drawable;
 import android.net.Uri;
 import android.os.AsyncTask;
+import android.os.UserManager;
 import android.provider.ContactsContract.DisplayPhoto;
 import android.provider.MediaStore;
 import android.support.v4.content.FileProvider;
@@ -95,6 +96,10 @@
                 showUpdatePhotoPopup();
             }
         });
+        final UserManager um = (UserManager) mContext.getSystemService(Context.USER_SERVICE);
+        if (um.hasUserRestriction(UserManager.DISALLOW_SET_USER_ICON)) {
+            mImageView.setEnabled(false);
+        }
         mNewUserPhotoBitmap = bitmap;
         mNewUserPhotoDrawable = drawable;
     }