diff --git a/res/values/arrays.xml b/res/values/arrays.xml
index 396a485..9c3a622 100644
--- a/res/values/arrays.xml
+++ b/res/values/arrays.xml
@@ -957,6 +957,9 @@
         <item>IPSec Xauth PSK</item>
         <item>IPSec Xauth RSA</item>
         <item>IPSec Hybrid RSA</item>
+        <item>IKEv2/IPSec MSCHAPv2</item>
+        <item>IKEv2/IPSec PSK</item>
+        <item>IKEv2/IPSec RSA</item>
     </string-array>
 
     <!-- Match this with the constants in VpnProfile. --> <skip />
@@ -968,6 +971,9 @@
         <item>IPSec VPN with pre-shared keys and Xauth authentication</item>
         <item>IPSec VPN with certificates and Xauth authentication</item>
         <item>IPSec VPN with certificates and hybrid authentication</item>
+        <item>IKEv2/IPSec VPN with certificates and username/password authentication</item>
+        <item>IKEv2/IPSec VPN with pre-shared keys</item>
+        <item>IKEv2/IPSec VPN with certificates</item>
     </string-array>
 
     <!-- VPN proxy settings. -->
diff --git a/res/values/config.xml b/res/values/config.xml
index fc2ca1f..86be2cb 100755
--- a/res/values/config.xml
+++ b/res/values/config.xml
@@ -434,4 +434,7 @@
 
     <!-- Package name of dialer supports RTT setting-->
     <string name="config_rtt_setting_package_name" translatable="false"></string>
+
+    <!--Whether tether settings should be shown in one screen or not-->
+    <bool name="config_show_all_in_one_tether_settings">false</bool>
 </resources>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index eede918..a153249 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -11510,7 +11510,7 @@
     <!-- DSU Loader. Do not translate. -->
     <string name="dsu_loader_title" translatable="false">DSU Loader</string>
     <!-- DSU Loader Description. Do not translate. -->
-    <string name="dsu_loader_description" translatable="false">Load a Dyanmic System Update Image</string>
+    <string name="dsu_loader_description" translatable="false">Load a Dynamic System Update Image</string>
     <!-- DSU Loader Loading. Do not translate. -->
     <string name="dsu_loader_loading" translatable="false">Loading...</string>
 
diff --git a/src/com/android/settings/AllInOneTetherSettings.java b/src/com/android/settings/AllInOneTetherSettings.java
index fbf0280..1c7ea1d 100644
--- a/src/com/android/settings/AllInOneTetherSettings.java
+++ b/src/com/android/settings/AllInOneTetherSettings.java
@@ -201,7 +201,7 @@
         // Assume we are in a SettingsActivity. This is only safe because we currently use
         // SettingsActivity as base for all preference fragments.
         final SettingsActivity activity = (SettingsActivity) getActivity();
-        BluetoothAdapter adapter = BluetoothAdapter.getDefaultAdapter();
+        final BluetoothAdapter adapter = BluetoothAdapter.getDefaultAdapter();
         if (adapter != null) {
             adapter.getProfileProxy(activity.getApplicationContext(), mProfileServiceListener,
                     BluetoothProfile.PAN);
@@ -405,6 +405,12 @@
                 }
 
                 @Override
+                protected boolean isPageSearchEnabled(Context context) {
+                    return context.getResources().getBoolean(
+                            R.bool.config_show_all_in_one_tether_settings);
+                }
+
+                @Override
                 public List<AbstractPreferenceController> createPreferenceControllers(
                         Context context) {
                     return buildPreferenceControllers(context, null /* AllTetherSettings */);
diff --git a/src/com/android/settings/IccLockSettings.java b/src/com/android/settings/IccLockSettings.java
index 97b5a0f..2dbfd62 100644
--- a/src/com/android/settings/IccLockSettings.java
+++ b/src/com/android/settings/IccLockSettings.java
@@ -545,7 +545,7 @@
         params.format = PixelFormat.TRANSLUCENT;
         params.windowAnimations = com.android.internal.R.style.Animation_Toast;
         params.type = WindowManager.LayoutParams.TYPE_STATUS_BAR_PANEL;
-        params.setFitWindowInsetsTypes(params.getFitWindowInsetsTypes() & ~Type.statusBars());
+        params.setFitInsetsTypes(params.getFitInsetsTypes() & ~Type.statusBars());
         params.setTitle(errorMessage);
         params.flags = WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON
                 | WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE
diff --git a/src/com/android/settings/TetherSettings.java b/src/com/android/settings/TetherSettings.java
index c5407c5..da86cbf 100644
--- a/src/com/android/settings/TetherSettings.java
+++ b/src/com/android/settings/TetherSettings.java
@@ -451,6 +451,12 @@
                 }
 
                 @Override
+                protected boolean isPageSearchEnabled(Context context) {
+                    return !context.getResources().getBoolean(
+                            R.bool.config_show_all_in_one_tether_settings);
+                }
+
+                @Override
                 public List<String> getNonIndexableKeys(Context context) {
                     final List<String> keys = super.getNonIndexableKeys(context);
                     final ConnectivityManager cm =
diff --git a/src/com/android/settings/location/RecentLocationRequestSeeAllFragment.java b/src/com/android/settings/location/RecentLocationRequestSeeAllFragment.java
index 48a6aec..3f0defd 100644
--- a/src/com/android/settings/location/RecentLocationRequestSeeAllFragment.java
+++ b/src/com/android/settings/location/RecentLocationRequestSeeAllFragment.java
@@ -54,7 +54,9 @@
 
         mController = use(RecentLocationRequestSeeAllPreferenceController.class);
         mController.init(this);
-        mController.setProfileType(profileType);
+        if (profileType != 0) {
+            mController.setProfileType(profileType);
+        }
     }
 
     @Override
diff --git a/src/com/android/settings/network/ApnEditor.java b/src/com/android/settings/network/ApnEditor.java
index 326d44b..091e7f5 100644
--- a/src/com/android/settings/network/ApnEditor.java
+++ b/src/com/android/settings/network/ApnEditor.java
@@ -137,6 +137,10 @@
     String[] mReadOnlyApnTypes;
     @VisibleForTesting
     String[] mDefaultApnTypes;
+    @VisibleForTesting
+    String mDefaultApnProtocol;
+    @VisibleForTesting
+    String mDefaultApnRoamingProtocol;
     private String[] mReadOnlyApnFields;
     private boolean mReadOnlyApn;
     private Uri mCarrierUri;
@@ -241,12 +245,14 @@
     private static final int AUTH_TYPE_INDEX = 14;
     @VisibleForTesting
     static final int TYPE_INDEX = 15;
-    private static final int PROTOCOL_INDEX = 16;
+    @VisibleForTesting
+    static final int PROTOCOL_INDEX = 16;
     @VisibleForTesting
     static final int CARRIER_ENABLED_INDEX = 17;
     private static final int BEARER_INDEX = 18;
     private static final int BEARER_BITMASK_INDEX = 19;
-    private static final int ROAMING_PROTOCOL_INDEX = 20;
+    @VisibleForTesting
+    static final int ROAMING_PROTOCOL_INDEX = 20;
     private static final int MVNO_TYPE_INDEX = 21;
     private static final int MVNO_MATCH_DATA_INDEX = 22;
     private static final int EDITED_INDEX = 23;
@@ -317,6 +323,19 @@
                 if (!ArrayUtils.isEmpty(mDefaultApnTypes)) {
                     Log.d(TAG, "onCreate: default apn types: " + Arrays.toString(mDefaultApnTypes));
                 }
+
+                mDefaultApnProtocol = b.getString(
+                        CarrierConfigManager.Apn.KEY_SETTINGS_DEFAULT_PROTOCOL_STRING);
+                if (!TextUtils.isEmpty(mDefaultApnProtocol)) {
+                    Log.d(TAG, "onCreate: default apn protocol: " + mDefaultApnProtocol);
+                }
+
+                mDefaultApnRoamingProtocol = b.getString(
+                        CarrierConfigManager.Apn.KEY_SETTINGS_DEFAULT_ROAMING_PROTOCOL_STRING);
+                if (!TextUtils.isEmpty(mDefaultApnRoamingProtocol)) {
+                    Log.d(TAG, "onCreate: default apn roaming protocol: "
+                            + mDefaultApnRoamingProtocol);
+                }
             }
         }
 
@@ -1029,13 +1048,13 @@
 
         callUpdate = setStringValueAndCheckIfDiff(values,
                 Telephony.Carriers.PROTOCOL,
-                checkNotSet(mProtocol.getValue()),
+                getUserEnteredApnProtocol(mProtocol, mDefaultApnProtocol),
                 callUpdate,
                 PROTOCOL_INDEX);
 
         callUpdate = setStringValueAndCheckIfDiff(values,
                 Telephony.Carriers.ROAMING_PROTOCOL,
-                checkNotSet(mRoamingProtocol.getValue()),
+                getUserEnteredApnProtocol(mRoamingProtocol, mDefaultApnRoamingProtocol),
                 callUpdate,
                 ROAMING_PROTOCOL_INDEX);
 
@@ -1232,6 +1251,17 @@
     }
 
     @VisibleForTesting
+    String getUserEnteredApnProtocol(ListPreference preference, String defaultApnProtocol) {
+        // if user has not specified a protocol or enter empty type, map it just for default
+        final String userEnteredApnProtocol = checkNotSet(
+                ((preference == null) ? null : preference.getValue()));
+        if (TextUtils.isEmpty(userEnteredApnProtocol)) {
+            return defaultApnProtocol;
+        }
+        return userEnteredApnProtocol.trim();
+    }
+
+    @VisibleForTesting
     String getUserEnteredApnType() {
         // if user has not specified a type, map it to "ALL APN TYPES THAT ARE NOT READ-ONLY"
         // but if user enter empty type, map it just for default
diff --git a/src/com/android/settings/network/TetherPreferenceController.java b/src/com/android/settings/network/TetherPreferenceController.java
index 0d4a6a6..5e52692 100644
--- a/src/com/android/settings/network/TetherPreferenceController.java
+++ b/src/com/android/settings/network/TetherPreferenceController.java
@@ -109,6 +109,10 @@
 
             // Grey out if provisioning is not available.
             mPreference.setEnabled(!TetherSettings.isProvisioningNeededButUnavailable(mContext));
+
+            if (mContext.getResources().getBoolean(R.bool.config_show_all_in_one_tether_settings)) {
+                mPreference.setFragment("com.android.settings.AllInOneTetherSettings");
+            }
         }
     }
 
diff --git a/src/com/android/settings/network/telephony/RenameMobileNetworkDialogFragment.java b/src/com/android/settings/network/telephony/RenameMobileNetworkDialogFragment.java
index 2340236..ab8327c 100644
--- a/src/com/android/settings/network/telephony/RenameMobileNetworkDialogFragment.java
+++ b/src/com/android/settings/network/telephony/RenameMobileNetworkDialogFragment.java
@@ -200,7 +200,7 @@
 
     private Color[] getColors() {
         final Resources res = getContext().getResources();
-        final int[] colorInts = res.getIntArray(com.android.internal.R.array.sim_colors);
+        final int[] colorInts = res.getIntArray(android.R.array.simColors);
         final String[] colorStrings = res.getStringArray(R.array.color_picker);
         final int iconSize = res.getDimensionPixelSize(R.dimen.color_swatch_size);
         final int strokeWidth = res.getDimensionPixelSize(R.dimen.color_swatch_stroke_width);
diff --git a/src/com/android/settings/users/EditUserInfoController.java b/src/com/android/settings/users/EditUserInfoController.java
index 4d9244a..373d6a9 100644
--- a/src/com/android/settings/users/EditUserInfoController.java
+++ b/src/com/android/settings/users/EditUserInfoController.java
@@ -20,10 +20,8 @@
 import android.app.Dialog;
 import android.content.DialogInterface;
 import android.content.Intent;
-import android.content.pm.UserInfo;
 import android.graphics.Bitmap;
 import android.graphics.drawable.Drawable;
-import android.os.AsyncTask;
 import android.os.Bundle;
 import android.os.UserHandle;
 import android.os.UserManager;
@@ -39,7 +37,6 @@
 import androidx.fragment.app.Fragment;
 
 import com.android.settings.R;
-import com.android.settingslib.Utils;
 import com.android.settingslib.drawable.CircleFramedDrawable;
 
 import java.io.File;
@@ -59,9 +56,24 @@
     private UserManager mUserManager;
     private boolean mWaitingForActivityResult = false;
 
+    /**
+     * Callback made when either the username text or photo choice changes.
+     */
     public interface OnContentChangedCallback {
-        public void onPhotoChanged(Drawable photo);
-        public void onLabelChanged(CharSequence label);
+        /** Photo updated. */
+        void onPhotoChanged(UserHandle user, Drawable photo);
+        /** Username updated. */
+        void onLabelChanged(UserHandle user, CharSequence label);
+    }
+
+    /**
+     * Callback made when the dialog finishes.
+     */
+    public interface OnDialogCompleteCallback {
+        /** Dialog closed with positive button. */
+        void onPositive();
+        /** Dialog closed with negative button or cancelled. */
+        void onNegativeOrCancel();
     }
 
     public void clear() {
@@ -111,7 +123,8 @@
 
     public Dialog createDialog(final Fragment fragment, final Drawable currentUserIcon,
             final CharSequence currentUserName,
-            int titleResId, final OnContentChangedCallback callback, UserHandle user) {
+            String title, final OnContentChangedCallback callback, UserHandle user,
+            OnDialogCompleteCallback completeCallback) {
         Activity activity = fragment.getActivity();
         mUser = user;
         if (mUserManager == null) {
@@ -120,10 +133,8 @@
         LayoutInflater inflater = activity.getLayoutInflater();
         View content = inflater.inflate(R.layout.edit_user_info_dialog_content, null);
 
-        UserInfo info = mUserManager.getUserInfo(mUser.getIdentifier());
-
         final EditText userNameView = (EditText) content.findViewById(R.id.user_name);
-        userNameView.setText(info.name);
+        userNameView.setText(currentUserName);
 
         final ImageView userPhotoView = (ImageView) content.findViewById(R.id.user_photo);
         Drawable drawable = null;
@@ -131,14 +142,11 @@
             drawable = CircleFramedDrawable.getInstance(activity, mSavedPhoto);
         } else {
             drawable = currentUserIcon;
-            if (drawable == null) {
-                drawable = Utils.getUserIcon(activity, mUserManager, info);
-            }
         }
         userPhotoView.setImageDrawable(drawable);
         mEditUserPhotoController = createEditUserPhotoController(fragment, userPhotoView, drawable);
         mEditUserInfoDialog = new AlertDialog.Builder(activity)
-                .setTitle(R.string.profile_info_settings_title)
+                .setTitle(title)
                 .setView(content)
                 .setCancelable(true)
                 .setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
@@ -149,41 +157,45 @@
                             CharSequence userName = userNameView.getText();
                             if (!TextUtils.isEmpty(userName)) {
                                 if (currentUserName == null
-                                        || !userName.toString().equals(currentUserName.toString())) {
+                                        || !userName.toString().equals(
+                                                currentUserName.toString())) {
                                     if (callback != null) {
-                                        callback.onLabelChanged(userName.toString());
+                                        callback.onLabelChanged(mUser, userName.toString());
                                     }
-                                    mUserManager.setUserName(mUser.getIdentifier(),
-                                            userName.toString());
                                 }
                             }
                             // Update the photo if changed.
                             Drawable drawable = mEditUserPhotoController.getNewUserPhotoDrawable();
-                            Bitmap bitmap = mEditUserPhotoController.getNewUserPhotoBitmap();
-                            if (drawable != null && bitmap != null
-                                    && !drawable.equals(currentUserIcon)) {
+                            if (drawable != null && !drawable.equals(currentUserIcon)) {
                                 if (callback != null) {
-                                    callback.onPhotoChanged(drawable);
+                                        callback.onPhotoChanged(mUser, drawable);
                                 }
-                                new AsyncTask<Void, Void, Void>() {
-                                    @Override
-                                    protected Void doInBackground(Void... params) {
-                                        mUserManager.setUserIcon(mUser.getIdentifier(),
-                                                mEditUserPhotoController.getNewUserPhotoBitmap());
-                                        return null;
-                                    }
-                                }.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, (Void[]) null);
                             }
                             fragment.getActivity().removeDialog(
                                     RestrictedProfileSettings.DIALOG_ID_EDIT_USER_INFO);
                         }
                         clear();
+                        if (completeCallback != null) {
+                            completeCallback.onPositive();
+                        }
                     }
                 })
                 .setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() {
                     @Override
                     public void onClick(DialogInterface dialog, int which) {
                         clear();
+                        if (completeCallback != null) {
+                            completeCallback.onNegativeOrCancel();
+                        }
+                    }
+                })
+                .setOnCancelListener(new DialogInterface.OnCancelListener() {
+                    @Override
+                    public void onCancel(DialogInterface dialog) {
+                        clear();
+                        if (completeCallback != null) {
+                            completeCallback.onNegativeOrCancel();
+                        }
                     }
                 })
                 .create();
diff --git a/src/com/android/settings/users/RestrictedProfileSettings.java b/src/com/android/settings/users/RestrictedProfileSettings.java
index b00ee83..57c0d02 100644
--- a/src/com/android/settings/users/RestrictedProfileSettings.java
+++ b/src/com/android/settings/users/RestrictedProfileSettings.java
@@ -23,12 +23,15 @@
 import android.content.pm.UserInfo;
 import android.graphics.drawable.Drawable;
 import android.os.Bundle;
+import android.os.UserHandle;
 import android.view.View;
 import android.widget.ImageView;
 import android.widget.TextView;
 
+import com.android.internal.util.UserIcons;
 import com.android.settings.R;
 import com.android.settings.Utils;
+import com.android.settingslib.utils.ThreadUtils;
 
 public class RestrictedProfileSettings extends AppRestrictionsFragment
         implements EditUserInfoController.OnContentChangedCallback {
@@ -117,8 +120,8 @@
     public Dialog onCreateDialog(int dialogId) {
         if (dialogId == DIALOG_ID_EDIT_USER_INFO) {
             return mEditUserInfoController.createDialog(this, mUserIconView.getDrawable(),
-                    mUserNameView.getText(), R.string.profile_info_settings_title,
-                    this, mUser);
+                    mUserNameView.getText(), getString(R.string.profile_info_settings_title),
+                    this, mUser, null);
         } else if (dialogId == DIALOG_CONFIRM_REMOVE) {
             Dialog dlg =
                     UserDialogs.createRemoveDialog(getActivity(), mUser.getIdentifier(),
@@ -156,12 +159,19 @@
     }
 
     @Override
-    public void onPhotoChanged(Drawable photo) {
+    public void onPhotoChanged(UserHandle user, Drawable photo) {
         mUserIconView.setImageDrawable(photo);
+        ThreadUtils.postOnBackgroundThread(new Runnable() {
+            @Override
+            public void run() {
+                mUserManager.setUserIcon(user.getIdentifier(), UserIcons.convertToBitmap(photo));
+            }
+        });
     }
 
     @Override
-    public void onLabelChanged(CharSequence label) {
+    public void onLabelChanged(UserHandle user, CharSequence label) {
         mUserNameView.setText(label);
+        mUserManager.setUserName(user.getIdentifier(), label.toString());
     }
 }
diff --git a/src/com/android/settings/users/UserSettings.java b/src/com/android/settings/users/UserSettings.java
index 7a9f026..cd305e9 100644
--- a/src/com/android/settings/users/UserSettings.java
+++ b/src/com/android/settings/users/UserSettings.java
@@ -16,6 +16,8 @@
 
 package com.android.settings.users;
 
+import static android.os.Process.myUserHandle;
+
 import android.app.Activity;
 import android.app.ActivityManager;
 import android.app.Dialog;
@@ -73,6 +75,7 @@
 import com.android.settingslib.RestrictedPreference;
 import com.android.settingslib.drawable.CircleFramedDrawable;
 import com.android.settingslib.search.SearchIndexable;
+import com.android.settingslib.utils.ThreadUtils;
 
 import com.google.android.setupcompat.util.WizardManagerHelper;
 
@@ -82,6 +85,7 @@
 import java.util.Collections;
 import java.util.HashMap;
 import java.util.List;
+import java.util.Random;
 
 /**
  * Screen that manages the list of users on the device.
@@ -95,8 +99,7 @@
 public class UserSettings extends SettingsPreferenceFragment
         implements Preference.OnPreferenceClickListener, View.OnClickListener,
         MultiUserSwitchBarController.OnMultiUserSwitchChangedListener,
-        DialogInterface.OnDismissListener,
-        EditUserInfoController.OnContentChangedCallback {
+        DialogInterface.OnDismissListener {
 
     private static final String TAG = "UserSettings";
 
@@ -125,6 +128,8 @@
     private static final int DIALOG_NEED_LOCKSCREEN = 7;
     private static final int DIALOG_CONFIRM_EXIT_GUEST = 8;
     private static final int DIALOG_USER_PROFILE_EDITOR = 9;
+    private static final int DIALOG_USER_PROFILE_EDITOR_ADD_USER = 10;
+    private static final int DIALOG_USER_PROFILE_EDITOR_ADD_RESTRICTED_PROFILE = 11;
 
     private static final int MESSAGE_UPDATE_LIST = 1;
     private static final int MESSAGE_SETUP_USER = 2;
@@ -168,6 +173,9 @@
     private AddUserWhenLockedPreferenceController mAddUserWhenLockedPreferenceController;
     private MultiUserFooterPreferenceController mMultiUserFooterPreferenceController;
 
+    private CharSequence mPendingUserName;
+    private Drawable mPendingUserIcon;
+
     // A place to cache the generated default avatar
     private Drawable mDefaultIconDrawable;
 
@@ -447,7 +455,7 @@
                         break;
                     case USER_TYPE_RESTRICTED_PROFILE:
                         if (hasLockscreenSecurity()) {
-                            addUserNow(USER_TYPE_RESTRICTED_PROFILE);
+                            showDialog(DIALOG_USER_PROFILE_EDITOR_ADD_RESTRICTED_PROFILE);
                         } else {
                             showDialog(DIALOG_NEED_LOCKSCREEN);
                         }
@@ -466,22 +474,6 @@
         }
     }
 
-    private UserInfo createRestrictedProfile() {
-        UserInfo newUserInfo = mUserManager.createRestrictedProfile(mAddingUserName);
-        if (newUserInfo != null && !assignDefaultPhoto(getActivity(), newUserInfo.id)) {
-            return null;
-        }
-        return newUserInfo;
-    }
-
-    private UserInfo createTrustedUser() {
-        UserInfo newUserInfo = mUserManager.createUser(mAddingUserName, 0);
-        if (newUserInfo != null && !assignDefaultPhoto(getActivity(), newUserInfo.id)) {
-            return null;
-        }
-        return newUserInfo;
-    }
-
     private void onManageUserClicked(int userId, boolean newUser) {
         mAddingUser = false;
         if (userId == UserPreference.USERID_GUEST_DEFAULTS) {
@@ -571,15 +563,13 @@
                 final int messageResId = longMessageDisplayed
                         ? R.string.user_add_user_message_short
                         : R.string.user_add_user_message_long;
-                final int userType = dialogId == DIALOG_ADD_USER
-                        ? USER_TYPE_USER : USER_TYPE_RESTRICTED_PROFILE;
                 Dialog dlg = new AlertDialog.Builder(context)
                         .setTitle(R.string.user_add_user_title)
                         .setMessage(messageResId)
                         .setPositiveButton(android.R.string.ok,
                                 new DialogInterface.OnClickListener() {
                                     public void onClick(DialogInterface dialog, int which) {
-                                        addUserNow(userType);
+                                        showDialog(DIALOG_USER_PROFILE_EDITOR_ADD_USER);
                                         if (!longMessageDisplayed) {
                                             preferences.edit().putBoolean(
                                                     KEY_ADD_USER_LONG_MESSAGE_DISPLAYED,
@@ -675,20 +665,96 @@
                 return dlg;
             }
             case DIALOG_USER_PROFILE_EDITOR: {
-                Dialog dlg = mEditUserInfoController.createDialog(
+                UserHandle user = myUserHandle();
+                UserInfo info = mUserManager.getUserInfo(user.getIdentifier());
+                return mEditUserInfoController.createDialog(
                         this,
-                        null,
-                        mMePreference.getTitle(),
-                        R.string.profile_info_settings_title,
-                        this /* callback */,
-                        android.os.Process.myUserHandle());
-                return dlg;
+                        Utils.getUserIcon(getPrefContext(), mUserManager, info),
+                        info.name,
+                        getString(R.string.profile_info_settings_title),
+                        new EditUserInfoController.OnContentChangedCallback() {
+                            @Override
+                            public void onPhotoChanged(UserHandle user, Drawable photo) {
+                                ThreadUtils.postOnBackgroundThread(new Runnable() {
+                                    @Override
+                                    public void run() {
+                                        mUserManager.setUserIcon(user.getIdentifier(),
+                                                UserIcons.convertToBitmap(photo));
+                                    }
+                                });
+                                mMePreference.setIcon(photo);
+                            }
+
+                            @Override
+                            public void onLabelChanged(UserHandle user, CharSequence label) {
+                                mMePreference.setTitle(label.toString());
+                                mUserManager.setUserName(user.getIdentifier(), label.toString());
+                            }
+                        },
+                        user,
+                        null);
+            }
+            case DIALOG_USER_PROFILE_EDITOR_ADD_USER: {
+                synchronized (mUserLock) {
+                    mPendingUserIcon = UserIcons.getDefaultUserIcon(getPrefContext().getResources(),
+                            new Random(System.currentTimeMillis()).nextInt(8), false);
+                    mPendingUserName = getString(R.string.user_new_user_name);
+                }
+                return buildAddUserProfileEditorDialog(USER_TYPE_USER);
+            }
+            case DIALOG_USER_PROFILE_EDITOR_ADD_RESTRICTED_PROFILE: {
+                synchronized (mUserLock) {
+                    mPendingUserIcon = UserIcons.getDefaultUserIcon(getPrefContext().getResources(),
+                            new Random(System.currentTimeMillis()).nextInt(8), false);
+                    mPendingUserName = getString(R.string.user_new_profile_name);
+                }
+                return buildAddUserProfileEditorDialog(USER_TYPE_RESTRICTED_PROFILE);
             }
             default:
                 return null;
         }
     }
 
+    private Dialog buildAddUserProfileEditorDialog(int userType) {
+        Dialog d;
+        synchronized (mUserLock) {
+            d = mEditUserInfoController.createDialog(
+                    this,
+                    mPendingUserIcon,
+                    mPendingUserName,
+                    getString(userType == USER_TYPE_USER
+                            ? R.string.user_info_settings_title
+                            : R.string.profile_info_settings_title),
+                    new EditUserInfoController.OnContentChangedCallback() {
+                        @Override
+                        public void onPhotoChanged(UserHandle user, Drawable photo) {
+                            mPendingUserIcon = photo;
+                        }
+
+                        @Override
+                        public void onLabelChanged(UserHandle user, CharSequence label) {
+                            mPendingUserName = label;
+                        }
+                    },
+                    myUserHandle(),
+                    new EditUserInfoController.OnDialogCompleteCallback() {
+                        @Override
+                        public void onPositive() {
+                            addUserNow(userType);
+                        }
+
+                        @Override
+                        public void onNegativeOrCancel() {
+                            synchronized (mUserLock) {
+                                mPendingUserIcon = null;
+                                mPendingUserName = null;
+                            }
+                        }
+                    });
+        }
+        return d;
+    }
+
     @Override
     public int getDialogMetricsCategory(int dialogId) {
         switch (dialogId) {
@@ -709,6 +775,8 @@
             case DIALOG_CONFIRM_EXIT_GUEST:
                 return SettingsEnums.DIALOG_USER_CONFIRM_EXIT_GUEST;
             case DIALOG_USER_PROFILE_EDITOR:
+            case DIALOG_USER_PROFILE_EDITOR_ADD_USER:
+            case DIALOG_USER_PROFILE_EDITOR_ADD_RESTRICTED_PROFILE:
                 return SettingsEnums.DIALOG_USER_EDIT_PROFILE;
             default:
                 return 0;
@@ -719,14 +787,15 @@
         if (mRemovingUserId == UserHandle.myUserId()) {
             removeThisUser();
         } else {
-            new Thread() {
+            ThreadUtils.postOnBackgroundThread(new Runnable() {
+                @Override
                 public void run() {
                     synchronized (mUserLock) {
                         mUserManager.removeUser(mRemovingUserId);
                         mHandler.sendEmptyMessage(MESSAGE_UPDATE_LIST);
                     }
                 }
-            }.start();
+            });
         }
     }
 
@@ -746,39 +815,59 @@
     private void addUserNow(final int userType) {
         synchronized (mUserLock) {
             mAddingUser = true;
-            mAddingUserName = userType == USER_TYPE_USER ? getString(R.string.user_new_user_name)
-                    : getString(R.string.user_new_profile_name);
-            //updateUserList();
-            new Thread() {
-                public void run() {
-                    UserInfo user;
-                    // Could take a few seconds
-                    if (userType == USER_TYPE_USER) {
-                        user = createTrustedUser();
-                    } else {
-                        user = createRestrictedProfile();
-                    }
+            mAddingUserName = userType == USER_TYPE_USER
+                    ? (mPendingUserName != null ? mPendingUserName.toString()
+                    : getString(R.string.user_new_user_name))
+                    : (mPendingUserName != null ? mPendingUserName.toString()
+                            : getString(R.string.user_new_profile_name));
+        }
+        ThreadUtils.postOnBackgroundThread(new Runnable() {
+            @Override
+            public void run() {
+                UserInfo user;
+                String username;
+
+                synchronized (mUserLock) {
+                    username = mAddingUserName;
+                }
+
+                // Could take a few seconds
+                if (userType == USER_TYPE_USER) {
+                    user = mUserManager.createUser(username, 0);
+                } else {
+                    user = mUserManager.createRestrictedProfile(username);
+                }
+
+                synchronized (mUserLock) {
                     if (user == null) {
                         mAddingUser = false;
+                        mPendingUserIcon = null;
+                        mPendingUserName = null;
                         return;
                     }
-                    synchronized (mUserLock) {
-                        if (userType == USER_TYPE_USER) {
-                            mHandler.sendEmptyMessage(MESSAGE_UPDATE_LIST);
-                            // Skip setting up user which results in user switching when the
-                            // restriction is set.
-                            if (!mUserCaps.mDisallowSwitchUser) {
-                                mHandler.sendMessage(mHandler.obtainMessage(
-                                        MESSAGE_SETUP_USER, user.id, user.serialNumber));
-                            }
-                        } else {
-                            mHandler.sendMessage(mHandler.obtainMessage(
-                                    MESSAGE_CONFIG_USER, user.id, user.serialNumber));
-                        }
+
+                    if (mPendingUserIcon != null) {
+                        mUserManager.setUserIcon(user.id,
+                                UserIcons.convertToBitmap(mPendingUserIcon));
                     }
+
+                    if (userType == USER_TYPE_USER) {
+                        mHandler.sendEmptyMessage(MESSAGE_UPDATE_LIST);
+                        // Skip setting up user which results in user switching when the
+                        // restriction is set.
+                        if (!mUserCaps.mDisallowSwitchUser) {
+                            mHandler.sendMessage(mHandler.obtainMessage(
+                                    MESSAGE_SETUP_USER, user.id, user.serialNumber));
+                        }
+                    } else {
+                        mHandler.sendMessage(mHandler.obtainMessage(
+                                MESSAGE_CONFIG_USER, user.id, user.serialNumber));
+                    }
+                    mPendingUserIcon = null;
+                    mPendingUserName = null;
                 }
-            }.start();
-        }
+            }
+        });
     }
 
     private void switchUserNow(int userId) {
@@ -1123,16 +1212,6 @@
         return R.string.help_url_users;
     }
 
-    @Override
-    public void onPhotoChanged(Drawable photo) {
-        mMePreference.setIcon(photo);
-    }
-
-    @Override
-    public void onLabelChanged(CharSequence label) {
-        mMePreference.setTitle(label);
-    }
-
     /**
      * Returns a default user icon (as a {@link Bitmap}) for the given user.
      *
diff --git a/src/com/android/settings/wifi/WifiConfigController2.java b/src/com/android/settings/wifi/WifiConfigController2.java
index ecf20fd..add37dd 100644
--- a/src/com/android/settings/wifi/WifiConfigController2.java
+++ b/src/com/android/settings/wifi/WifiConfigController2.java
@@ -276,7 +276,7 @@
                 mHiddenSettingsSpinner.getSelectedItemPosition() == NOT_HIDDEN_NETWORK
                         ? View.GONE
                         : View.VISIBLE);
-        mSecurityInPosition = new Integer[WifiEntry.SECURITY_MAX_VAL];
+        mSecurityInPosition = new Integer[WifiEntry.NUM_SECURITY_TYPES];
 
         if (mWifiEntry == null) { // new network
             configureSecuritySpinner();
@@ -411,7 +411,7 @@
                     }
 
                     addRow(group, R.string.wifi_security,
-                            WifiEntryShell.getSecurityString(mWifiEntry, false));
+                            mWifiEntry.getSecurityString(false /* concise */));
                     mView.findViewById(R.id.ip_fields).setVisibility(View.GONE);
                 }
                 if (mWifiEntry.isSaved()
diff --git a/src/com/android/settings/wifi/WifiEntryShell.java b/src/com/android/settings/wifi/WifiEntryShell.java
index 2af0d7b..7c6fc48 100644
--- a/src/com/android/settings/wifi/WifiEntryShell.java
+++ b/src/com/android/settings/wifi/WifiEntryShell.java
@@ -48,13 +48,6 @@
      */
     public static final int HIGHER_FREQ_5GHZ = 5900;
 
-    /**
-     * Mapping of the corresponding {@link AccessPoint} method
-     */
-    public static String getSecurityString(WifiEntry wifiEntry, boolean concise) {
-        return "None";
-    }
-
     // Passpoint methods
 
     /**
diff --git a/src/com/android/settings/wifi/details2/WifiDetailPreferenceController2.java b/src/com/android/settings/wifi/details2/WifiDetailPreferenceController2.java
index 5193213..b5813cf 100644
--- a/src/com/android/settings/wifi/details2/WifiDetailPreferenceController2.java
+++ b/src/com/android/settings/wifi/details2/WifiDetailPreferenceController2.java
@@ -330,7 +330,7 @@
         mIpv6Category = screen.findPreference(KEY_IPV6_CATEGORY);
         mIpv6AddressPref = screen.findPreference(KEY_IPV6_ADDRESSES_PREF);
 
-        mSecurityPref.setSummary(WifiEntryShell.getSecurityString(mWifiEntry, /* concise */ false));
+        mSecurityPref.setSummary(mWifiEntry.getSecurityString(false /* concise */));
     }
 
     private void setupEntityHeader(PreferenceScreen screen) {
diff --git a/src/com/android/settings/wifi/dpp/WifiDppUtils.java b/src/com/android/settings/wifi/dpp/WifiDppUtils.java
index 93a3530..51cb351 100644
--- a/src/com/android/settings/wifi/dpp/WifiDppUtils.java
+++ b/src/com/android/settings/wifi/dpp/WifiDppUtils.java
@@ -252,11 +252,6 @@
         final WifiConfiguration wifiConfiguration = wifiEntry.getWifiConfiguration();
         setConfiguratorIntentExtra(intent, wifiManager, wifiConfiguration);
 
-        // For a transition mode Wi-Fi AP, creates a QR code that's compatible with more devices
-        if (wifiEntry.getSecurity() == WifiEntry.SECURITY_PSK_SAE_TRANSITION) {
-            intent.putExtra(EXTRA_WIFI_SECURITY, WifiQrCode.SECURITY_WPA_PSK);
-        }
-
         return intent;
     }
 
diff --git a/src/com/android/settings/wifi/tether/WifiTetherSettings.java b/src/com/android/settings/wifi/tether/WifiTetherSettings.java
index 3c4a001..4665515 100644
--- a/src/com/android/settings/wifi/tether/WifiTetherSettings.java
+++ b/src/com/android/settings/wifi/tether/WifiTetherSettings.java
@@ -258,6 +258,12 @@
                 }
 
                 @Override
+                protected boolean isPageSearchEnabled(Context context) {
+                    return !context.getResources().getBoolean(
+                            R.bool.config_show_all_in_one_tether_settings);
+                }
+
+                @Override
                 public List<AbstractPreferenceController> createPreferenceControllers(
                         Context context) {
                     return buildPreferenceControllers(context, null /* listener */);
diff --git a/tests/robotests/src/com/android/settings/AllInOneTetherSettingsTest.java b/tests/robotests/src/com/android/settings/AllInOneTetherSettingsTest.java
index 51c856a..37a3474 100644
--- a/tests/robotests/src/com/android/settings/AllInOneTetherSettingsTest.java
+++ b/tests/robotests/src/com/android/settings/AllInOneTetherSettingsTest.java
@@ -69,18 +69,21 @@
     }
 
     @Test
-    public void getNonIndexableKeys_tetherAvailable_keysNotReturned() {
+    public void getNonIndexableKeys_tetherAvailable_keysReturned() {
         // To let TetherUtil.isTetherAvailable return true, select one of the combinations
         setupIsTetherAvailable(true);
 
         final List<String> niks =
                 AllInOneTetherSettings.SEARCH_INDEX_DATA_PROVIDER.getNonIndexableKeys(mContext);
 
-        assertThat(niks).doesNotContain(AllInOneTetherSettings.KEY_WIFI_TETHER_NETWORK_NAME);
-        assertThat(niks).doesNotContain(AllInOneTetherSettings.KEY_WIFI_TETHER_NETWORK_PASSWORD);
-        assertThat(niks).doesNotContain(AllInOneTetherSettings.KEY_WIFI_TETHER_AUTO_OFF);
-        assertThat(niks).doesNotContain(AllInOneTetherSettings.KEY_WIFI_TETHER_NETWORK_AP_BAND);
-        assertThat(niks).doesNotContain(AllInOneTetherSettings.KEY_TETHER_PREFS_SCREEN);
+        // TODO(b/147675042) Should revert these assertions, after switching to new UI.
+        // Because of the config check, we are not indexing these keys. Once we enable the config
+        // these assert would also need to change.
+        assertThat(niks).contains(AllInOneTetherSettings.KEY_WIFI_TETHER_NETWORK_NAME);
+        assertThat(niks).contains(AllInOneTetherSettings.KEY_WIFI_TETHER_NETWORK_PASSWORD);
+        assertThat(niks).contains(AllInOneTetherSettings.KEY_WIFI_TETHER_AUTO_OFF);
+        assertThat(niks).contains(AllInOneTetherSettings.KEY_WIFI_TETHER_NETWORK_AP_BAND);
+        assertThat(niks).contains(AllInOneTetherSettings.KEY_TETHER_PREFS_SCREEN);
     }
 
     @Test
diff --git a/tests/robotests/src/com/android/settings/network/ApnEditorTest.java b/tests/robotests/src/com/android/settings/network/ApnEditorTest.java
index 3aa6a6f..e291a43 100644
--- a/tests/robotests/src/com/android/settings/network/ApnEditorTest.java
+++ b/tests/robotests/src/com/android/settings/network/ApnEditorTest.java
@@ -25,7 +25,6 @@
 import static org.mockito.Mockito.never;
 import static org.mockito.Mockito.spy;
 import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
 
 import android.content.ContentResolver;
 import android.content.ContentValues;
@@ -57,7 +56,6 @@
 import org.mockito.Mock;
 import org.mockito.Mockito;
 import org.mockito.MockitoAnnotations;
-import org.robolectric.Robolectric;
 import org.robolectric.RobolectricTestRunner;
 import org.robolectric.RuntimeEnvironment;
 import org.robolectric.annotation.Config;
@@ -246,7 +244,6 @@
     @Test
     public void testValidateApnData_validData_shouldReturnNull() {
         // GIVEN a valid apn data
-        mApnEditorUT.mApnData = new FakeApnData(APN_DATA);
         mApnEditorUT.fillUI(true /* firstTime */);
 
         // WHEN validate the apn data
@@ -259,9 +256,7 @@
     @Test
     public void testValidateApn_apnNameNotSet_shouldReturnErrorMessage() {
         // GIVEN a apn data without the apn name
-        final FakeApnData apnData = new FakeApnData(APN_DATA);
-        apnData.mData[ApnEditor.NAME_INDEX] = "";
-        mApnEditorUT.mApnData = apnData;
+        mApnEditorUT.mApnData.mData[ApnEditor.NAME_INDEX] = "";
         mApnEditorUT.fillUI(true /* firstTime */);
 
         // THEN validate the apn data
@@ -274,9 +269,7 @@
     @Test
     public void testValidateApnData_apnNotSet_shouldReturnErrorMessage() {
         // GIVEN a apn data without the apn
-        final FakeApnData apnData = new FakeApnData(APN_DATA);
-        apnData.mData[ApnEditor.APN_INDEX] = "";
-        mApnEditorUT.mApnData = apnData;
+        mApnEditorUT.mApnData.mData[ApnEditor.APN_INDEX] = "";
         mApnEditorUT.fillUI(true /* firstTime */);
 
         // THEN validate the apn data
@@ -288,11 +281,8 @@
 
     @Test
     public void testValidateApnData_mccInvalid_shouldReturnErrorMessage() {
-        // GIVEN a apn data with invalid mcc
-        final FakeApnData apnData = new FakeApnData(APN_DATA);
         // The length of the mcc should be 3
-        apnData.mData[ApnEditor.MCC_INDEX] = "1324";
-        mApnEditorUT.mApnData = apnData;
+        mApnEditorUT.mApnData.mData[ApnEditor.MCC_INDEX] = "1324";
         mApnEditorUT.fillUI(true /* firstTime */);
 
         // WHEN validate the apn data
@@ -305,10 +295,8 @@
     @Test
     public void testValidateApnData_mncInvalid_shouldReturnErrorMessage() {
         // GIVEN an apn data with invalid mnc
-        final FakeApnData apnData = new FakeApnData(APN_DATA);
         // The length of the mnc should be 2 or 3
-        apnData.mData[ApnEditor.MNC_INDEX] = "1324";
-        mApnEditorUT.mApnData = apnData;
+        mApnEditorUT.mApnData.mData[ApnEditor.MNC_INDEX] = "1324";
         mApnEditorUT.fillUI(true /* firstTime */);
 
         // WHEN validate the apn data
@@ -321,7 +309,6 @@
     @Test
     public void testSaveApnData_pressBackButtonWithValidApnData_shouldSaveApnData() {
         // GIVEN a valid apn data
-        mApnEditorUT.mApnData = new FakeApnData(APN_DATA);
         mApnEditorUT.fillUI(true /* firstTime */);
 
         // WHEN press the back button
@@ -336,7 +323,6 @@
     @Test
     public void testSaveApnData_pressSaveButtonWithValidApnData_shouldSaveApnData() {
         // GIVEN a valid apn data
-        mApnEditorUT.mApnData = new FakeApnData(APN_DATA);
         mApnEditorUT.fillUI(true /* firstTime */);
 
         // WHEN press the save button
@@ -353,10 +339,8 @@
     @Test
     public void testSaveApnData_apnDataInvalid_shouldNotSaveApnData() {
         // GIVEN an invalid apn data
-        final FakeApnData apnData = new FakeApnData(APN_DATA);
         // The valid apn data should contains a non-empty apn name
-        apnData.mData[ApnEditor.NAME_INDEX] = "";
-        mApnEditorUT.mApnData = apnData;
+        mApnEditorUT.mApnData.mData[ApnEditor.NAME_INDEX] = "";
         mApnEditorUT.fillUI(true /* firstTime */);
 
         // WHEN press the save button
@@ -475,19 +459,45 @@
     }
 
     @Test
+    public void getUserEnteredApnProtocol_emptyApnProtocol_shouldReturnDefaultIPv4v6() {
+        // GIVEN read default APN protocol with IPV4V6
+        mApnEditorUT.mDefaultApnProtocol = "IPV4V6";
+
+        // Input empty in TYPE
+        mApnEditorUT.mApnData.mData[ApnEditor.PROTOCOL_INDEX] = "";
+        mApnEditorUT.fillUI(true /* firstTime */);
+
+        // THEN APN type should be IPV4V6
+        assertThat(mApnEditorUT.getUserEnteredApnProtocol(
+                mApnEditorUT.mProtocol, mApnEditorUT.mDefaultApnProtocol))
+                .isEqualTo("IPV4V6");
+    }
+
+    @Test
+    public void getUserEnteredApnProtocol_emptyApnProtocol_shouldReturnDefaultIP() {
+        // GIVEN read default APN protocol with IP
+        mApnEditorUT.mDefaultApnProtocol = "IP";
+
+        // Input empty in TYPE
+        mApnEditorUT.mApnData.mData[ApnEditor.PROTOCOL_INDEX] = "";
+        mApnEditorUT.fillUI(true /* firstTime */);
+
+        // THEN APN type should be IPV4V6
+        assertThat(mApnEditorUT.getUserEnteredApnProtocol(
+                mApnEditorUT.mProtocol, mApnEditorUT.mDefaultApnProtocol))
+                .isEqualTo("IP");
+    }
+
+    @Test
     public void getUserEnteredApnType_emptyApnType_shouldReturnDefault() {
         // case 1
         // GIVEN read only APN types with DUN
-        String[] readOnlyApnTypes = {"dun"};
-        mApnEditorUT.mReadOnlyApnTypes = readOnlyApnTypes;
+        mApnEditorUT.mReadOnlyApnTypes = new String [] {"dun"};
         // GIVEN read specificApnTypeForEmptyInput with DEFAULT,DUN
-        String[] defaultApnTypes = {"default", "dun"};
-        mApnEditorUT.mDefaultApnTypes = defaultApnTypes;
+        mApnEditorUT.mDefaultApnTypes = new String [] {"default", "dun"};
 
         // Input empty in TYPE
-        final FakeApnData apnData = new FakeApnData(APN_DATA);
-        apnData.mData[ApnEditor.TYPE_INDEX] = "";
-        mApnEditorUT.mApnData = apnData;
+        mApnEditorUT.mApnData.mData[ApnEditor.TYPE_INDEX] = "";
         mApnEditorUT.fillUI(true /* firstTime */);
 
         // THEN APN type should be default
@@ -495,16 +505,12 @@
 
         // case 2
         // GIVEN read only APN types with DUN
-        String[] readOnlyApnTypesCase2 = {"dun"};
-        mApnEditorUT.mReadOnlyApnTypes = readOnlyApnTypesCase2;
+        mApnEditorUT.mReadOnlyApnTypes = new String [] {"dun"};
         // GIVEN read specificApnTypeForEmptyInput with DEFAULT
-        String[] defaultApnTypesCase2 = {"default"};
-        mApnEditorUT.mDefaultApnTypes = defaultApnTypesCase2;
+        mApnEditorUT.mDefaultApnTypes = new String [] {"default"};
 
         // Input empty in TYPE
-        final FakeApnData apnDataCase2 = new FakeApnData(APN_DATA);
-        apnDataCase2.mData[ApnEditor.TYPE_INDEX] = "";
-        mApnEditorUT.mApnData = apnDataCase2;
+        mApnEditorUT.mApnData.mData[ApnEditor.TYPE_INDEX] = "";
         mApnEditorUT.fillUI(true /* firstTime */);
 
         // THEN APN type should be default
diff --git a/tests/robotests/src/com/android/settings/users/EditUserInfoControllerTest.java b/tests/robotests/src/com/android/settings/users/EditUserInfoControllerTest.java
index a6a76f8..1c191fa 100644
--- a/tests/robotests/src/com/android/settings/users/EditUserInfoControllerTest.java
+++ b/tests/robotests/src/com/android/settings/users/EditUserInfoControllerTest.java
@@ -18,13 +18,16 @@
 
 import static com.google.common.truth.Truth.assertThat;
 
+import static org.mockito.ArgumentMatchers.any;
 import static org.mockito.ArgumentMatchers.eq;
 import static org.mockito.ArgumentMatchers.same;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.spy;
+import static org.mockito.Mockito.times;
 import static org.mockito.Mockito.verify;
 import static org.mockito.Mockito.when;
 
+import android.app.Dialog;
 import android.content.Intent;
 import android.graphics.drawable.Drawable;
 import android.widget.EditText;
@@ -37,9 +40,6 @@
 import com.android.settings.R;
 import com.android.settings.testutils.shadow.ShadowAlertDialogCompat;
 
-import java.util.stream.Collectors;
-import java.util.stream.Stream;
-
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -50,6 +50,9 @@
 import org.robolectric.android.controller.ActivityController;
 import org.robolectric.annotation.Config;
 
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+
 @RunWith(RobolectricTestRunner.class)
 public class EditUserInfoControllerTest {
     private static final int MAX_USER_NAME_LENGTH = 100;
@@ -88,7 +91,8 @@
     @Test
     public void photoControllerOnActivityResult_whenWaiting_isCalled() {
         mController.createDialog(mFragment, mCurrentIcon, "test user",
-                R.string.profile_info_settings_title, null, android.os.Process.myUserHandle());
+                "title", null,
+                android.os.Process.myUserHandle(), null);
         mController.startingActivityForResult();
         Intent resultData = new Intent();
         mController.onActivityResult(0, 0, resultData);
@@ -104,8 +108,8 @@
         final String longName = Stream.generate(
                 () -> String.valueOf('A')).limit(200).collect(Collectors.joining());
         final AlertDialog dialog = (AlertDialog) mController.createDialog(mFragment, mCurrentIcon,
-                "test user", R.string.profile_info_settings_title, null,
-                android.os.Process.myUserHandle());
+                "test user", "title", null,
+                android.os.Process.myUserHandle(), null);
         final EditText userName = ShadowAlertDialogCompat.shadowOf(dialog).getView()
                 .findViewById(R.id.user_name);
 
@@ -113,4 +117,143 @@
 
         assertThat(userName.getText().length()).isEqualTo(MAX_USER_NAME_LENGTH);
     }
+
+    @Test
+    public void onDialogCompleteCallback_isCalled_whenCancelled() {
+        EditUserInfoController.OnContentChangedCallback contentChangeCallback = mock(
+                EditUserInfoController.OnContentChangedCallback.class);
+
+        EditUserInfoController.OnDialogCompleteCallback dialogCompleteCallback = mock(
+                EditUserInfoController.OnDialogCompleteCallback.class);
+
+        AlertDialog dialog = (AlertDialog) mController.createDialog(
+                mFragment, mCurrentIcon, "test",
+                "title", contentChangeCallback,
+                android.os.Process.myUserHandle(),
+                dialogCompleteCallback);
+
+        dialog.show();
+        dialog.cancel();
+
+        verify(contentChangeCallback, times(0))
+                .onLabelChanged(any(), any());
+        verify(contentChangeCallback, times(0))
+                .onPhotoChanged(any(), any());
+        verify(dialogCompleteCallback, times(0)).onPositive();
+        verify(dialogCompleteCallback, times(1)).onNegativeOrCancel();
+    }
+
+    @Test
+    public void onDialogCompleteCallback_isCalled_whenPositiveClicked() {
+        EditUserInfoController.OnContentChangedCallback contentChangeCallback = mock(
+                EditUserInfoController.OnContentChangedCallback.class);
+
+        EditUserInfoController.OnDialogCompleteCallback dialogCompleteCallback = mock(
+                EditUserInfoController.OnDialogCompleteCallback.class);
+
+        AlertDialog dialog = (AlertDialog) mController.createDialog(
+                mFragment, mCurrentIcon, "test",
+                "title", contentChangeCallback,
+                android.os.Process.myUserHandle(),
+                dialogCompleteCallback);
+
+        // No change to the photo.
+        when(mController.getPhotoController().getNewUserPhotoDrawable()).thenReturn(mCurrentIcon);
+
+        dialog.show();
+        dialog.getButton(Dialog.BUTTON_POSITIVE).performClick();
+
+        verify(contentChangeCallback, times(0))
+                .onLabelChanged(any(), any());
+        verify(contentChangeCallback, times(0))
+                .onPhotoChanged(any(), any());
+        verify(dialogCompleteCallback, times(1)).onPositive();
+        verify(dialogCompleteCallback, times(0)).onNegativeOrCancel();
+    }
+
+    @Test
+    public void onDialogCompleteCallback_isCalled_whenNegativeClicked() {
+        EditUserInfoController.OnContentChangedCallback contentChangeCallback = mock(
+                EditUserInfoController.OnContentChangedCallback.class);
+
+        EditUserInfoController.OnDialogCompleteCallback dialogCompleteCallback = mock(
+                EditUserInfoController.OnDialogCompleteCallback.class);
+
+        AlertDialog dialog = (AlertDialog) mController.createDialog(
+                mFragment, mCurrentIcon, "test",
+                "title", contentChangeCallback,
+                android.os.Process.myUserHandle(),
+                dialogCompleteCallback);
+
+        dialog.show();
+        dialog.getButton(Dialog.BUTTON_NEGATIVE).performClick();
+
+        verify(contentChangeCallback, times(0))
+                .onLabelChanged(any(), any());
+        verify(contentChangeCallback, times(0))
+                .onPhotoChanged(any(), any());
+        verify(dialogCompleteCallback, times(0)).onPositive();
+        verify(dialogCompleteCallback, times(1)).onNegativeOrCancel();
+    }
+
+    @Test
+    public void onContentChangedCallback_isCalled_whenLabelChanges() {
+        EditUserInfoController.OnContentChangedCallback contentChangeCallback = mock(
+                EditUserInfoController.OnContentChangedCallback.class);
+
+        EditUserInfoController.OnDialogCompleteCallback dialogCompleteCallback = mock(
+                EditUserInfoController.OnDialogCompleteCallback.class);
+
+        AlertDialog dialog = (AlertDialog) mController.createDialog(
+                mFragment, mCurrentIcon, "test",
+                "title", contentChangeCallback,
+                android.os.Process.myUserHandle(),
+                dialogCompleteCallback);
+
+        // No change to the photo.
+        when(mController.getPhotoController().getNewUserPhotoDrawable()).thenReturn(mCurrentIcon);
+
+        dialog.show();
+        String expectedNewName = "new test user";
+        EditText editText = (EditText) dialog.findViewById(R.id.user_name);
+        editText.setText(expectedNewName);
+
+        dialog.getButton(Dialog.BUTTON_POSITIVE).performClick();
+
+        verify(contentChangeCallback, times(1))
+                .onLabelChanged(any(), eq(expectedNewName));
+        verify(contentChangeCallback, times(0))
+                .onPhotoChanged(any(), any());
+        verify(dialogCompleteCallback, times(1)).onPositive();
+        verify(dialogCompleteCallback, times(0)).onNegativeOrCancel();
+    }
+
+    @Test
+    public void onContentChangedCallback_isCalled_whenPhotoChanges() {
+        EditUserInfoController.OnContentChangedCallback contentChangeCallback = mock(
+                EditUserInfoController.OnContentChangedCallback.class);
+
+        EditUserInfoController.OnDialogCompleteCallback dialogCompleteCallback = mock(
+                EditUserInfoController.OnDialogCompleteCallback.class);
+
+        AlertDialog dialog = (AlertDialog) mController.createDialog(
+                mFragment, mCurrentIcon, "test",
+                "title", contentChangeCallback,
+                android.os.Process.myUserHandle(),
+                dialogCompleteCallback);
+
+        // A different drawable.
+        Drawable newPhoto = mock(Drawable.class);
+        when(mController.getPhotoController().getNewUserPhotoDrawable()).thenReturn(newPhoto);
+
+        dialog.show();
+        dialog.getButton(Dialog.BUTTON_POSITIVE).performClick();
+
+        verify(contentChangeCallback, times(0))
+                .onLabelChanged(any(), any());
+        verify(contentChangeCallback, times(1))
+                .onPhotoChanged(any(), eq(newPhoto));
+        verify(dialogCompleteCallback, times(1)).onPositive();
+        verify(dialogCompleteCallback, times(0)).onNegativeOrCancel();
+    }
 }
