Merge "Remove feature flag SETTINGS_GUEST_MODE_UX_CHANGES" into tm-qpr-dev

This commit is contained in:
Kedar Chitnis
2022-08-27 04:36:57 +00:00
committed by Android (Google) Code Review
3 changed files with 53 additions and 114 deletions

View File

@@ -83,11 +83,6 @@ public class FeatureFlagUtils {
public static final String SETTINGS_HIDE_SECOND_LAYER_PAGE_NAVIGATE_UP_BUTTON_IN_TWO_PANE = public static final String SETTINGS_HIDE_SECOND_LAYER_PAGE_NAVIGATE_UP_BUTTON_IN_TWO_PANE =
"settings_hide_second_layer_page_navigate_up_button_in_two_pane"; "settings_hide_second_layer_page_navigate_up_button_in_two_pane";
/** Flag to enable/disable guest mode UX changes as mentioned in b/214031645
* @hide
*/
public static final String SETTINGS_GUEST_MODE_UX_CHANGES = "settings_guest_mode_ux_changes";
/** Support Clear Calling feature. /** Support Clear Calling feature.
* @hide * @hide
*/ */
@@ -120,7 +115,6 @@ public class FeatureFlagUtils {
DEFAULT_FLAGS.put(SETTINGS_ENABLE_MONITOR_PHANTOM_PROCS, "true"); DEFAULT_FLAGS.put(SETTINGS_ENABLE_MONITOR_PHANTOM_PROCS, "true");
DEFAULT_FLAGS.put(SETTINGS_APP_ALLOW_DARK_THEME_ACTIVATION_AT_BEDTIME, "true"); DEFAULT_FLAGS.put(SETTINGS_APP_ALLOW_DARK_THEME_ACTIVATION_AT_BEDTIME, "true");
DEFAULT_FLAGS.put(SETTINGS_HIDE_SECOND_LAYER_PAGE_NAVIGATE_UP_BUTTON_IN_TWO_PANE, "true"); DEFAULT_FLAGS.put(SETTINGS_HIDE_SECOND_LAYER_PAGE_NAVIGATE_UP_BUTTON_IN_TWO_PANE, "true");
DEFAULT_FLAGS.put(SETTINGS_GUEST_MODE_UX_CHANGES, "true");
DEFAULT_FLAGS.put(SETTINGS_ENABLE_CLEAR_CALLING, "false"); DEFAULT_FLAGS.put(SETTINGS_ENABLE_CLEAR_CALLING, "false");
} }

View File

@@ -25,7 +25,6 @@ import android.content.pm.UserInfo;
import android.os.Bundle; import android.os.Bundle;
import android.os.UserHandle; import android.os.UserHandle;
import android.provider.Settings; import android.provider.Settings;
import android.util.FeatureFlagUtils;
import com.android.internal.messages.nano.SystemMessageProto; import com.android.internal.messages.nano.SystemMessageProto;
import com.android.systemui.util.NotificationChannels; import com.android.systemui.util.NotificationChannels;
@@ -59,10 +58,8 @@ public final class GuestSessionNotification {
} }
void createPersistentNotification(UserInfo userInfo, boolean isGuestFirstLogin) { void createPersistentNotification(UserInfo userInfo, boolean isGuestFirstLogin) {
if (!FeatureFlagUtils.isEnabled(mContext, if (!userInfo.isGuest()) {
FeatureFlagUtils.SETTINGS_GUEST_MODE_UX_CHANGES) // we create a persistent notification only for guests
|| !userInfo.isGuest()) {
// we create a persistent notification only if enabled and only for guests
return; return;
} }
String contentText; String contentText;

View File

@@ -45,7 +45,6 @@ import android.os.UserManager;
import android.provider.Settings; import android.provider.Settings;
import android.telephony.TelephonyCallback; import android.telephony.TelephonyCallback;
import android.text.TextUtils; import android.text.TextUtils;
import android.util.FeatureFlagUtils;
import android.util.Log; import android.util.Log;
import android.util.SparseArray; import android.util.SparseArray;
import android.util.SparseBooleanArray; import android.util.SparseBooleanArray;
@@ -287,10 +286,6 @@ public class UserSwitcherController implements Dumpable {
refreshUsers(UserHandle.USER_NULL); refreshUsers(UserHandle.USER_NULL);
} }
private static boolean isEnableGuestModeUxChanges(Context context) {
return FeatureFlagUtils.isEnabled(context, FeatureFlagUtils.SETTINGS_GUEST_MODE_UX_CHANGES);
}
/** /**
* Refreshes users from UserManager. * Refreshes users from UserManager.
* *
@@ -549,17 +544,9 @@ public class UserSwitcherController implements Dumpable {
} }
if (currUserInfo != null && currUserInfo.isGuest()) { if (currUserInfo != null && currUserInfo.isGuest()) {
if (isEnableGuestModeUxChanges(mContext)) { showExitGuestDialog(currUserId, currUserInfo.isEphemeral(),
showExitGuestDialog(currUserId, currUserInfo.isEphemeral(), record.resolveId(), dialogShower);
record.resolveId(), dialogShower); return;
return;
} else {
if (currUserInfo.isEphemeral()) {
showExitGuestDialog(currUserId, currUserInfo.isEphemeral(),
record.resolveId(), dialogShower);
return;
}
}
} }
if (dialogShower != null) { if (dialogShower != null) {
@@ -1056,14 +1043,8 @@ public class UserSwitcherController implements Dumpable {
public String getName(Context context, UserRecord item) { public String getName(Context context, UserRecord item) {
if (item.isGuest) { if (item.isGuest) {
if (item.isCurrent) { if (item.isCurrent) {
if (isEnableGuestModeUxChanges(context)) { return context.getString(
return context.getString( com.android.settingslib.R.string.guest_exit_quick_settings_button);
com.android.settingslib.R.string.guest_exit_quick_settings_button);
} else {
return context.getString(mController.mGuestUserAutoCreated
? com.android.settingslib.R.string.guest_reset_guest
: com.android.settingslib.R.string.guest_exit_guest);
}
} else { } else {
if (item.info != null) { if (item.info != null) {
return context.getString(com.android.internal.R.string.guest_name); return context.getString(com.android.internal.R.string.guest_name);
@@ -1080,13 +1061,8 @@ public class UserSwitcherController implements Dumpable {
? com.android.settingslib.R.string.guest_resetting ? com.android.settingslib.R.string.guest_resetting
: com.android.internal.R.string.guest_name); : com.android.internal.R.string.guest_name);
} else { } else {
if (isEnableGuestModeUxChanges(context)) { // we always show "guest" as string, instead of "add guest"
// we always show "guest" as string, instead of "add guest" return context.getString(com.android.internal.R.string.guest_name);
return context.getString(com.android.internal.R.string.guest_name);
} else {
return context.getString(
com.android.settingslib.R.string.guest_new_guest);
}
} }
} }
} }
@@ -1108,11 +1084,7 @@ public class UserSwitcherController implements Dumpable {
protected static Drawable getIconDrawable(Context context, UserRecord item) { protected static Drawable getIconDrawable(Context context, UserRecord item) {
int iconRes; int iconRes;
if (item.isAddUser) { if (item.isAddUser) {
if (isEnableGuestModeUxChanges(context)) { iconRes = R.drawable.ic_add;
iconRes = R.drawable.ic_add;
} else {
iconRes = R.drawable.ic_account_circle_filled;
}
} else if (item.isGuest) { } else if (item.isGuest) {
iconRes = R.drawable.ic_account_circle; iconRes = R.drawable.ic_account_circle;
} else if (item.isAddSupervisedUser) { } else if (item.isAddSupervisedUser) {
@@ -1289,46 +1261,32 @@ public class UserSwitcherController implements Dumpable {
ExitGuestDialog(Context context, int guestId, boolean isGuestEphemeral, ExitGuestDialog(Context context, int guestId, boolean isGuestEphemeral,
int targetId) { int targetId) {
super(context); super(context);
if (isEnableGuestModeUxChanges(context)) { if (isGuestEphemeral) {
if (isGuestEphemeral) { setTitle(context.getString(
setTitle(context.getString( com.android.settingslib.R.string.guest_exit_dialog_title));
com.android.settingslib.R.string.guest_exit_dialog_title)); setMessage(context.getString(
setMessage(context.getString( com.android.settingslib.R.string.guest_exit_dialog_message));
com.android.settingslib.R.string.guest_exit_dialog_message));
setButton(DialogInterface.BUTTON_NEUTRAL,
context.getString(android.R.string.cancel), this);
setButton(DialogInterface.BUTTON_POSITIVE,
context.getString(
com.android.settingslib.R.string.guest_exit_dialog_button), this);
} else {
setTitle(context.getString(
com.android.settingslib
.R.string.guest_exit_dialog_title_non_ephemeral));
setMessage(context.getString(
com.android.settingslib
.R.string.guest_exit_dialog_message_non_ephemeral));
setButton(DialogInterface.BUTTON_NEUTRAL,
context.getString(android.R.string.cancel), this);
setButton(DialogInterface.BUTTON_NEGATIVE,
context.getString(
com.android.settingslib.R.string.guest_exit_clear_data_button),
this);
setButton(DialogInterface.BUTTON_POSITIVE,
context.getString(
com.android.settingslib.R.string.guest_exit_save_data_button),
this);
}
} else {
setTitle(mGuestUserAutoCreated
? com.android.settingslib.R.string.guest_reset_guest_dialog_title
: com.android.settingslib.R.string.guest_remove_guest_dialog_title);
setMessage(context.getString(R.string.guest_exit_guest_dialog_message));
setButton(DialogInterface.BUTTON_NEUTRAL, setButton(DialogInterface.BUTTON_NEUTRAL,
context.getString(android.R.string.cancel), this); context.getString(android.R.string.cancel), this);
setButton(DialogInterface.BUTTON_POSITIVE, setButton(DialogInterface.BUTTON_POSITIVE,
context.getString(mGuestUserAutoCreated context.getString(
? com.android.settingslib.R.string.guest_reset_guest_confirm_button com.android.settingslib.R.string.guest_exit_dialog_button), this);
: com.android.settingslib.R.string.guest_remove_guest_confirm_button), } else {
setTitle(context.getString(
com.android.settingslib
.R.string.guest_exit_dialog_title_non_ephemeral));
setMessage(context.getString(
com.android.settingslib
.R.string.guest_exit_dialog_message_non_ephemeral));
setButton(DialogInterface.BUTTON_NEUTRAL,
context.getString(android.R.string.cancel), this);
setButton(DialogInterface.BUTTON_NEGATIVE,
context.getString(
com.android.settingslib.R.string.guest_exit_clear_data_button),
this);
setButton(DialogInterface.BUTTON_POSITIVE,
context.getString(
com.android.settingslib.R.string.guest_exit_save_data_button),
this); this);
} }
SystemUIDialog.setWindowOnTop(this, mKeyguardStateController.isShowing()); SystemUIDialog.setWindowOnTop(this, mKeyguardStateController.isShowing());
@@ -1345,39 +1303,29 @@ public class UserSwitcherController implements Dumpable {
if (mFalsingManager.isFalseTap(penalty)) { if (mFalsingManager.isFalseTap(penalty)) {
return; return;
} }
if (isEnableGuestModeUxChanges(getContext())) { if (mIsGuestEphemeral) {
if (mIsGuestEphemeral) { if (which == DialogInterface.BUTTON_POSITIVE) {
if (which == DialogInterface.BUTTON_POSITIVE) { mDialogLaunchAnimator.dismissStack(this);
mDialogLaunchAnimator.dismissStack(this); // Ephemeral guest: exit guest, guest is removed by the system
// Ephemeral guest: exit guest, guest is removed by the system // on exit, since its marked ephemeral
// on exit, since its marked ephemeral exitGuestUser(mGuestId, mTargetId, false);
exitGuestUser(mGuestId, mTargetId, false); } else if (which == DialogInterface.BUTTON_NEGATIVE) {
} else if (which == DialogInterface.BUTTON_NEGATIVE) { // Cancel clicked, do nothing
// Cancel clicked, do nothing cancel();
cancel();
}
} else {
if (which == DialogInterface.BUTTON_POSITIVE) {
mDialogLaunchAnimator.dismissStack(this);
// Non-ephemeral guest: exit guest, guest is not removed by the system
// on exit, since its marked non-ephemeral
exitGuestUser(mGuestId, mTargetId, false);
} else if (which == DialogInterface.BUTTON_NEGATIVE) {
mDialogLaunchAnimator.dismissStack(this);
// Non-ephemeral guest: remove guest and then exit
exitGuestUser(mGuestId, mTargetId, true);
} else if (which == DialogInterface.BUTTON_NEUTRAL) {
// Cancel clicked, do nothing
cancel();
}
} }
} else { } else {
if (which == BUTTON_NEUTRAL) { if (which == DialogInterface.BUTTON_POSITIVE) {
cancel();
} else {
mUiEventLogger.log(QSUserSwitcherEvent.QS_USER_GUEST_REMOVE);
mDialogLaunchAnimator.dismissStack(this); mDialogLaunchAnimator.dismissStack(this);
removeGuestUser(mGuestId, mTargetId); // Non-ephemeral guest: exit guest, guest is not removed by the system
// on exit, since its marked non-ephemeral
exitGuestUser(mGuestId, mTargetId, false);
} else if (which == DialogInterface.BUTTON_NEGATIVE) {
mDialogLaunchAnimator.dismissStack(this);
// Non-ephemeral guest: remove guest and then exit
exitGuestUser(mGuestId, mTargetId, true);
} else if (which == DialogInterface.BUTTON_NEUTRAL) {
// Cancel clicked, do nothing
cancel();
} }
} }
} }