Sunday, April 2, 2017

multi user - Is there a way to remove the Guest account?


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.


Is there a way to completely disable the guest feature?



Answer



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 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?




  1. Install a file manager with root explorer feature or a build prop editor app.

  2. 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.

  3. 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.



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.


No comments:

Post a Comment

samsung galaxy s 2 - Cannot restore Kies backup after firmware upgrade

I backed up my Samsung Galaxy S2 on Kies before updating to Ice Cream Sandwich. After the upgrade I tried to restore, but the restore fails ...