Guest mode UX flow updates to user settings
- Add option in user settings to enable/disable ephemeral
mode for guest user
- Update user settings to show exit guest and reset guest preferences
- Update user settings to show guest related preferences grouped together
Bug: 214031645, 175795666
Screenshots: go/ephemeral-guest-b-214031645-ux
Test: Manual test on sunfish, atest SystemUITests, atest SettingsRoboTests
Relands ag/16544951 after fixing post submit issues
Revert "Revert "Guest mode UX flow updates to user settings""
This reverts commit ed45e8c56a
.
Change-Id: I54583f9021171ae523ff40d4f63835f1cb486e35
This commit is contained in:
@@ -73,6 +73,7 @@ public class UserDetailsSettings extends SettingsPreferenceFragment
|
||||
private static final int DIALOG_CONFIRM_ENABLE_CALLING_AND_SMS = 3;
|
||||
private static final int DIALOG_SETUP_USER = 4;
|
||||
private static final int DIALOG_CONFIRM_RESET_GUEST = 5;
|
||||
private static final int DIALOG_CONFIRM_RESET_GUEST_AND_SWITCH_USER = 6;
|
||||
|
||||
/** Whether to enable the app_copying fragment. */
|
||||
private static final boolean SHOW_APP_COPYING_PREF = false;
|
||||
@@ -142,6 +143,11 @@ public class UserDetailsSettings extends SettingsPreferenceFragment
|
||||
if (canSwitchUserNow()) {
|
||||
if (shouldShowSetupPromptDialog()) {
|
||||
showDialog(DIALOG_SETUP_USER);
|
||||
} else if (mUserCaps.mIsGuest && mUserCaps.mIsEphemeral) {
|
||||
// if we are switching away from a ephemeral guest then,
|
||||
// show a dialog that guest user will be reset and then switch
|
||||
// the user
|
||||
showDialog(DIALOG_CONFIRM_RESET_GUEST_AND_SWITCH_USER);
|
||||
} else {
|
||||
switchUser();
|
||||
}
|
||||
@@ -173,6 +179,7 @@ public class UserDetailsSettings extends SettingsPreferenceFragment
|
||||
switch (dialogId) {
|
||||
case DIALOG_CONFIRM_REMOVE:
|
||||
case DIALOG_CONFIRM_RESET_GUEST:
|
||||
case DIALOG_CONFIRM_RESET_GUEST_AND_SWITCH_USER:
|
||||
return SettingsEnums.DIALOG_USER_REMOVE;
|
||||
case DIALOG_CONFIRM_ENABLE_CALLING:
|
||||
return SettingsEnums.DIALOG_USER_ENABLE_CALLING;
|
||||
@@ -216,6 +223,14 @@ public class UserDetailsSettings extends SettingsPreferenceFragment
|
||||
return UserDialogs.createRemoveGuestDialog(getActivity(),
|
||||
(dialog, which) -> resetGuest());
|
||||
}
|
||||
case DIALOG_CONFIRM_RESET_GUEST_AND_SWITCH_USER:
|
||||
if (mGuestUserAutoCreated) {
|
||||
return UserDialogs.createResetGuestDialog(getActivity(),
|
||||
(dialog, which) -> switchUser());
|
||||
} else {
|
||||
return UserDialogs.createRemoveGuestDialog(getActivity(),
|
||||
(dialog, which) -> switchUser());
|
||||
}
|
||||
}
|
||||
throw new IllegalArgumentException("Unsupported dialogId " + dialogId);
|
||||
}
|
||||
@@ -361,6 +376,16 @@ public class UserDetailsSettings extends SettingsPreferenceFragment
|
||||
if (mUserInfo.isGuest()) {
|
||||
mMetricsFeatureProvider.action(getActivity(), SettingsEnums.ACTION_SWITCH_TO_GUEST);
|
||||
}
|
||||
if (mUserCaps.mIsGuest && mUserCaps.mIsEphemeral) {
|
||||
int guestUserId = UserHandle.myUserId();
|
||||
// Using markGuestForDeletion allows us to create a new guest before this one is
|
||||
// fully removed.
|
||||
boolean marked = mUserManager.markGuestForDeletion(guestUserId);
|
||||
if (!marked) {
|
||||
Log.w(TAG, "Couldn't mark the guest for deletion for user " + guestUserId);
|
||||
return;
|
||||
}
|
||||
}
|
||||
ActivityManager.getService().switchUser(mUserInfo.id);
|
||||
} catch (RemoteException re) {
|
||||
Log.e(TAG, "Error while switching to other user.");
|
||||
|
Reference in New Issue
Block a user