Lollipop has put an emphasis on multiple users, which is just irksome on a personal phone. I don't need a guest account and I don't need a bright blue user icon reminding me I could be someone else.

I've disabled adding a guest from the lock screen (really a sensible default?!), and I've logged in as guest, pulled down and clicked "Remove Guest". But back in my normal account I still see the guest account icon when I pull down the top bar and click the blue user thing.

6 Answers
6

Edit: Firstly, please follow the answer here. It offers an easier approach and is tested with Android 7.1.1.

Some users have reported that the following solution didn't work for Android Marshmallow and above. That may be so since I tested this with Android Lollipop and worked well on it.

Yes and No! It depends upon how you want to use this answer.

I still see the guest account icon when I pull down the top bar and click the blue user thing.

You don't need to go that far by completely disabling the guest user to avoid that guest account icon when you pull down the top bar and click your profile image. All you've to do is remove all other users from Settings → Users and change the value of a key.

The key is guest_user_enabled under the table global found at /data/data/com.android.providers.settings/databases/settings.db. This database belongs to Settings Storage app. Its current value would be 1. Change it to 0 using adb with the command:

adb shell settings put global guest_user_enabled 0

Changes should take place immediately, otherwise, simply restart the phone.

Now, whenever you would tap your profile image in the top bar you would see the profile contact (if already created) or a toast saying "The contact doesn't exist". That icon wouldn't show itself as long as you don't create any more users.

Note: As noted above, it is important to remove all other users since the said method wouldn't work as long as any secondary user remains in the system.

The aforesaid technique simply deals with the nuisance that icon is to some users. It doesn't restrict the primary user (owner) to switch or create new user from Settings → Users.

What if I'm happy with having a single user (me) and don't want to see that User in the Settings?

That would require root access. There are devices under the banner Android One which are now running Android Lollipop yet do not have multi-user functionality. It turned out that the [multi-user] feature is disabled (the feature is disabled using framework as noted here) [can be enabled] using few entries in build.prop. Why not use that technique for our advantage?

Hide Users from Settings

The location of build.prop is /system/build.prop. Open the file, go to the end, create a new line and enter fw.show_multiuserui=0.

Reboot the device.

Go to Settings and you would notice that Users entry is missing. As a side-effect, the result in first section i.e. the removal of the guest icon is also covered by this solution.

The good part is that while guest/secondary user is nowhere to be found which you can switch to using GUI, you can still use that multi-user feature. adb shell am switch-user USER_ID can switch the user easily provided that you know the USER_ID of the guest/secondary user which you can obtain from /data/system/users/.

On the other hand, adb shell pm create-user USER_NAME can create a new user too. All good here.

What if I don't feel the need to have my device being used by a secondary user at all? I don't want multi-user functionality in my device?

That can be done. Thanks to Android One technique.

Remove multi-user feature

We're not removing the feature from the system but simply restricting the system to a single user. As mentioned in the last section, we need to edit build.prop which requires root access.

Add fw.max_users=1 in build.prop and restart the device. This would restrict the system from creating any new user since the maximum user is set to one. It would also hide the entry Users from Settings as well as the guest user icon aka the nuisance.

Note that you can always switch to the guest/secondary accounts using adb shell am switch-user USER_ID even after restricting the maximum users to one since the restriction is set to curb further creation of the users. If you feel the need to remove those users but find it bit problematic that there is no option now to remove them from GUI, then simply do adb shell pm remove-user USER_ID.

Superb answer. fw.max_users=1 worked for me. I was looking for this after accidentally logging in as a guest while the phone was in my pocket, and having a moment of extreme panic while I thought I had accidentally done a hard reset on my device!
– Mark ChOct 9 '15 at 6:06

1

Followed every step here on Cyanogenmod 13 (Android 6.0), still get the little blue user switch icon in the top right of the lock screen. Except now it prompts me to add a new contact.
– detlyJun 5 '16 at 12:41

1

@Firelord I figured it was something like that, so I didn't downvote. If I find out how to do it on M, I'll add something to your answer.
– detlyJun 5 '16 at 23:16

1

The first option with ADB shell does not seems to work on Nougat.
– Charles MiletteJul 20 '17 at 3:24

2

@arnuschky When I wrote this answer I had Lollipop only, and Nougat or Marshmallow were not released, so I don't think the answer is incorrect, it just doesn't apply on newer versions of Android.
– Firelord♦Aug 21 '17 at 12:42

This was down voted, but this is the most cleanest solution. The other two answers suggest a ton of unneeded steps. Note you have to be the guest user, to disable guest functionality. You cannot do this as a admin user.
– MeowMeowMar 8 '17 at 16:25

7

This does not remove the Guest account, it just removes the data for the last Guest login.
– Kai CarverOct 12 '17 at 1:40

1

For me it seemed to remove the option to switch to Guest.
– nafgMar 5 '18 at 17:43

I used adb shell settings put global guest_user_enabled 0 command from above and THEN I had switched to guest account and removed it, as described user205426 and ONLY AFTER THAT the guest account feature was disabled.
– Igor BljahhinNov 16 '18 at 18:32

In my device, this worked. It disables guest account and removes it from notification bar. It can be enabled again right if I go to settings and switch to guest account again.
– Sep GHJan 15 at 11:25

After much effort, I tried this simple method and it worked to solve the problem of being able to create a new user or logon as a guest with zero prompts for a password from the lock screen. Note that you actually have to log on using the guest account for this to work:

Log onto the guest account, and then from settings -> users -> remove guest user.
After a reboot, the option to create a new user or logon as a guest is no longer available from the lock screen.

With apologies, Andrew. My original post was truncated somehow. I've updated it to add the following: "Log onto the guest account, and then from settings -> users -> remove guest user. After a reboot, the option to create a new user or logon as a guest is no longer available from the lock screen." It seems crazy that this step would resolve the problem, but TouchWiz is such a pile of dung, I suppose it's not really surprising that this weird step would have such an affect.
– Darryl GittinsMar 27 '17 at 14:09

Without rooting the device and still be able to change build.prop, no need for adb or developer tools.

In short: I found the right twrp for my device, then used latest Odin to flash twrp on it. Then from twrp advanced file manager copied build.prop from system to an SD card, restart, modify the copied build.prop, restart into twrp, rename original file (basically make a backup), and copy back the modified file into system. then select it and use the chmod 755 button (or go into the terminal and run chmod 744 build.prop. Note that only root can have write permissions or your device won't boot).

Specific: (tested on a Samsung Tab A T550 9.7" with Android Marshmallow 6.0.1)

Google and download the latest Odin, unzip it.

Google twrp and your device, download it. I don't know if the latest version of twrp works for every device, but at worst it won't but it won't harm your device.

Search how to restart your device in download mode. Mine was pressing power+home+downvol for approximately 4 sec. (while the device is powered off, obviously).

When the download screen appears, connect to the PC and open Odin. The device detected under com should be blue.

Press the ap button and browse to select the twrp file you downloaded.

Verify that re-partition is not checked under the Options tab.

Press start.

The device reboots normally, you need to power it off and start in twrp mode. In my case it was done by pressing power+home+upvol for approximately 4 sec.

In twrp, don't start in read mode (the first time it asks). You won't root, but you will change a system file.

In my case while using twrp, the touch detection was a bit off to the left and I needed to press harder, so beware the annoying and damaging fat fingers.

Press the mount button, select system so it's checked, and uncheck read mode if it's selected.

Go back (press Home) and press the Advanced button, then File Manager.

Go to System, then select build.prop file.

Press copy file, select a destination folder where any user can read it. I used an SD card (you can use the terminal to chmod the file copied, but it is faster from Windows).

Go back and press Reboot, then System. It will reboot normally.

Connect the device to the PC and open the copied build.prop (Notepad won't work. Use Notepad++) and edit what you want. In my case I only added fw.max_users=1 below the last line. Save it.

if you couldn't open it because of permissions, first copy the file into the desktop and then modify that file then copy it back and replace it.

Disconnect the device and restart into twrp.

Again go to mount and check system, then go to Advanced and then use the file manager to go to system and select build.prop.

Rename it (add .bak at the end or whatever) so it's backed up.

Browse to the modified build.prop, and copy or move it to the system directory.

Browse to the system directory and select the newly copied build.prop, then press the chmod 755 button and confirm, as I said, even if you don't modify the original file. Just changing permissions to grant write access to anyone besides root will make your device hang on boot. If that happens, restart by pressing power + downvol for some time. Then immediately after it powers off press either power+home+upvol (twrp to change back whatever you did) or power+home+downvol (download mode, if all fails you can still flash the official image from Odin, you just have to Google your device and the Android version then official image, make sure it's the right one).

Restart and it's done, no more guest or add user, and no rooting, although from download you can flash a root image (if there is one for your device) or from twrp you can install Supersu to become root. You can say this method is as difficult as rooting, but I prefer to avoid rooting. twrp will be there, but it won't get in the way of anything.

As you can see, that blue icon for user account at the top is no more visible. The Settings app also hides the Users settings option.

How does the mod works?

There is a fantastic binary made available on-the-fly by Magisk framework named resetprop (under /sbin) which does the magic. It is instructed to change fw.show_multiuserui and fw.max_users in memory before SystemUI app is loaded.

Then simply unzip it into a directory (Get Winzip or similar).
Run CMD (the DOS command window)
and use the CD command to get into that directory where the adb.exe is (from the zip file).
Then test with adb devices.
Then go for it.

I did a second Samsung tablet with the above procedure and it did not immediately work. Rebooted and still no work. But then switched to guest. Then in the swipe down from top notifications I deleted the guest account (puts you back to owner user). Then ran the script again and wala! : The guest option was gone from the lock screen. Curious on this tablet the script results in no user icon at all on the lock screen (like a phone) but the other tablet (newer) still had the user icon on the lock screen but when tapped did not present the guest option. Both worked but just in different ways.
– user281599Dec 11 '18 at 20:10

Thank you for your interest in this question.
Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).