Merge "Remove feature flag SETTINGS_GUEST_MODE_UX_CHANGES" into tm-qpr-dev
diff --git a/src/com/android/settings/users/RemoveGuestOnExitPreferenceController.java b/src/com/android/settings/users/RemoveGuestOnExitPreferenceController.java
index 182494c..01df5fd 100644
--- a/src/com/android/settings/users/RemoveGuestOnExitPreferenceController.java
+++ b/src/com/android/settings/users/RemoveGuestOnExitPreferenceController.java
@@ -24,7 +24,6 @@
 import android.os.Handler;
 import android.os.UserManager;
 import android.provider.Settings;
-import android.util.FeatureFlagUtils;
 import android.util.Log;
 
 import androidx.appcompat.app.AlertDialog;
@@ -87,9 +86,7 @@
                 || !UserManager.isGuestUserAllowEphemeralStateChange()
                 || !mUserCaps.isAdmin()
                 || mUserCaps.disallowAddUser()
-                || mUserCaps.disallowAddUserSetByAdmin()
-                || !FeatureFlagUtils.isEnabled(mContext,
-                        FeatureFlagUtils.SETTINGS_GUEST_MODE_UX_CHANGES)) {
+                || mUserCaps.disallowAddUserSetByAdmin()) {
             return DISABLED_FOR_USER;
         } else {
             return mUserCaps.mUserSwitcherEnabled ? AVAILABLE : CONDITIONALLY_UNAVAILABLE;
diff --git a/src/com/android/settings/users/UserSettings.java b/src/com/android/settings/users/UserSettings.java
index ca03e3f..914130d 100644
--- a/src/com/android/settings/users/UserSettings.java
+++ b/src/com/android/settings/users/UserSettings.java
@@ -49,7 +49,6 @@
 import android.provider.ContactsContract;
 import android.provider.Settings;
 import android.text.TextUtils;
-import android.util.FeatureFlagUtils;
 import android.util.Log;
 import android.util.SparseArray;
 import android.view.Gravity;
@@ -470,11 +469,6 @@
         updateUserList();
     }
 
-    private boolean isEnableGuestModeUxChanges() {
-        return FeatureFlagUtils.isEnabled(getContext(),
-                FeatureFlagUtils.SETTINGS_GUEST_MODE_UX_CHANGES);
-    }
-
     /**
      * Loads profile information for the current user.
      */
@@ -1345,33 +1339,25 @@
         }
         mGuestCategory.setVisible(true);
         mGuestExitPreference.setVisible(true);
-        if (isEnableGuestModeUxChanges()) {
-            mGuestResetPreference.setVisible(true);
+        mGuestResetPreference.setVisible(true);
 
-            boolean isGuestFirstLogin = Settings.Secure.getIntForUser(
-                                            getContext().getContentResolver(),
-                                            SETTING_GUEST_HAS_LOGGED_IN,
-                                            0,
-                                            UserHandle.myUserId()) <= 1;
-            String guestExitSummary;
-            if (mUserCaps.mIsEphemeral) {
-                guestExitSummary = getContext().getString(
-                                    R.string.guest_notification_ephemeral);
-            } else if (isGuestFirstLogin) {
-                guestExitSummary = getContext().getString(
-                                    R.string.guest_notification_non_ephemeral);
-            } else {
-                guestExitSummary = getContext().getString(
-                                    R.string.guest_notification_non_ephemeral_non_first_login);
-            }
-            mGuestExitPreference.setSummary(guestExitSummary);
+        boolean isGuestFirstLogin = Settings.Secure.getIntForUser(
+                                        getContext().getContentResolver(),
+                                        SETTING_GUEST_HAS_LOGGED_IN,
+                                        0,
+                                        UserHandle.myUserId()) <= 1;
+        String guestExitSummary;
+        if (mUserCaps.mIsEphemeral) {
+            guestExitSummary = getContext().getString(
+                                R.string.guest_notification_ephemeral);
+        } else if (isGuestFirstLogin) {
+            guestExitSummary = getContext().getString(
+                                R.string.guest_notification_non_ephemeral);
         } else {
-            mGuestExitPreference.setIcon(getEncircledDefaultIcon());
-            mGuestExitPreference.setTitle(
-                                    mGuestUserAutoCreated
-                                        ? com.android.settingslib.R.string.guest_reset_guest
-                                        : com.android.settingslib.R.string.guest_exit_guest);
+            guestExitSummary = getContext().getString(
+                                R.string.guest_notification_non_ephemeral_non_first_login);
         }
+        mGuestExitPreference.setSummary(guestExitSummary);
     }
 
     private void updateGuestCategory(Context context, List<UserInfo> users) {
@@ -1400,16 +1386,12 @@
             pref.setOnPreferenceClickListener(this);
             pref.setEnabled(canOpenUserDetails);
             pref.setSelectable(true);
-            if (isEnableGuestModeUxChanges()) {
-                Drawable icon = getContext().getDrawable(R.drawable.ic_account_circle_outline);
-                icon.setTint(
-                        getColorAttrDefaultColor(getContext(), android.R.attr.colorControlNormal));
-                pref.setIcon(encircleUserIcon(
-                        UserIcons.convertToBitmapAtUserIconSize(
-                                getContext().getResources(), icon)));
-            } else {
-                pref.setIcon(getEncircledDefaultIcon());
-            }
+            Drawable icon = getContext().getDrawable(R.drawable.ic_account_circle_outline);
+            icon.setTint(
+                    getColorAttrDefaultColor(getContext(), android.R.attr.colorControlNormal));
+            pref.setIcon(encircleUserIcon(
+                    UserIcons.convertToBitmapAtUserIconSize(
+                            getContext().getResources(), icon)));
             pref.setKey(KEY_USER_GUEST);
             pref.setOrder(Preference.DEFAULT_ORDER);
             if (mUserCaps.mDisallowSwitchUser) {
@@ -1451,13 +1433,6 @@
                 && mUserCaps.mUserSwitcherEnabled) {
             isVisible = true;
             mAddGuest.setVisible(true);
-            // when isEnableGuestModeUxChanges() is true, the icon is set via the layout xml
-            // In com.android.settings.users.UserSettingsTest
-            // we disable the check for setIcon being called
-            if (!isEnableGuestModeUxChanges()) {
-                Drawable icon = context.getDrawable(R.drawable.ic_account_circle);
-                mAddGuest.setIcon(centerAndTint(icon));
-            }
             mAddGuest.setSelectable(true);
             if (mGuestUserAutoCreated && mGuestCreationScheduled.get()) {
                 mAddGuest.setTitle(com.android.internal.R.string.guest_name);
@@ -1475,21 +1450,11 @@
 
     private void updateAddUser(Context context) {
         updateAddUserCommon(context, mAddUser, mUserCaps.mCanAddRestrictedProfile);
-        // when isEnableGuestModeUxChanges() is true, the icon is set via the layout xml
-        if (!isEnableGuestModeUxChanges()) {
-            Drawable icon = context.getDrawable(R.drawable.ic_account_circle_filled);
-            mAddUser.setIcon(centerAndTint(icon));
-        }
     }
 
     private void updateAddSupervisedUser(Context context) {
         if (!TextUtils.isEmpty(mConfigSupervisedUserCreationPackage)) {
             updateAddUserCommon(context, mAddSupervisedUser, false);
-            // when isEnableGuestModeUxChanges() is true, the icon is set via the layout xml
-            if (!isEnableGuestModeUxChanges()) {
-                Drawable icon = context.getDrawable(R.drawable.ic_add_supervised_user);
-                mAddSupervisedUser.setIcon(centerAndTint(icon));
-            }
         } else {
             mAddSupervisedUser.setVisible(false);
         }
@@ -1586,28 +1551,17 @@
     @Override
     public boolean onPreferenceClick(Preference pref) {
         if (isCurrentUserGuest()) {
-            if (isEnableGuestModeUxChanges()) {
-                if (mGuestResetPreference != null && pref == mGuestResetPreference) {
-                    showDialog(DIALOG_CONFIRM_RESET_AND_RESTART_GUEST);
-                    return true;
+            if (mGuestResetPreference != null && pref == mGuestResetPreference) {
+                showDialog(DIALOG_CONFIRM_RESET_AND_RESTART_GUEST);
+                return true;
+            }
+            if (mGuestExitPreference != null && pref == mGuestExitPreference) {
+                if (mUserCaps.mIsEphemeral) {
+                    showDialog(DIALOG_CONFIRM_EXIT_GUEST_EPHEMERAL);
+                } else {
+                    showDialog(DIALOG_CONFIRM_EXIT_GUEST_NON_EPHEMERAL);
                 }
-                if (mGuestExitPreference != null && pref == mGuestExitPreference) {
-                    if (mUserCaps.mIsEphemeral) {
-                        showDialog(DIALOG_CONFIRM_EXIT_GUEST_EPHEMERAL);
-                    } else {
-                        showDialog(DIALOG_CONFIRM_EXIT_GUEST_NON_EPHEMERAL);
-                    }
-                    return true;
-                }
-            } else {
-                if (mGuestExitPreference != null && pref == mGuestExitPreference) {
-                    if (mGuestUserAutoCreated) {
-                        showDialog(DIALOG_CONFIRM_REMOVE_GUEST_WITH_AUTO_CREATE);
-                    } else {
-                        showDialog(DIALOG_CONFIRM_REMOVE_GUEST);
-                    }
-                    return true;
-                }
+                return true;
             }
         }
         if (pref == mMePreference) {