Post Reply

[MOD] Add multi-user support to Android 4.2 roms using device overlay (phone)

OP rogro82

28th November 2012, 10:38 AM   |  #1  
rogro82's Avatar
OP Senior Recognized Developer
Thanks Meter: 440
 
862 posts
Join Date:Joined: May 2008
Donate to Me
More
I dont know if this has already been posted, but I could not find anything that enabled multi-user support directly.

It is fairly simple to add multi-user support to your Android 4.2 rom using the device overlay.

To enable multi-user support you will have to add the following to your config.xml:
<integer name="config_multiuserMaximumUsers">8</integer>

This will enable the Users section in Settings to add/remove new users.

Additionally you will have to modify layout-port/keyguard_host_view.xml, because the layout-port version of keyguard_host_view.xml does not have the multi-user selector.

You will need to add the following to the layout:
<include layout="@layout/keyguard_multi_user_selector"/>

Instead of modifying the layout xml directly you can also just add a modified version of the .xml to your device overlay.

That will add the user selector to the keyguard/lockscreen.

The changes can be found here:
https://github.com/adrian-bl-hox-jb/...ac8617cc9abc9f



In case there is just one user it will not show the user selector in the keyguard/lockscreen.

Known issues:

* The dialer only works in the main user and and trying to dial in any other user will result in a crash, because the dialer does not support multi-user yet.
Last edited by rogro82; 3rd December 2012 at 03:06 PM.
The Following 7 Users Say Thank You to rogro82 For This Useful Post: [ View ]
28th November 2012, 03:03 PM   |  #2  
broodplank1337's Avatar
Recognized Contributor / Recognized Developer
Flag Nijmegen
Thanks Meter: 10,046
 
4,941 posts
Join Date:Joined: Nov 2011
Donate to Me
More
Cool, thanks for sharing! (Although, I think having more users on an android device is kinda useless, but very nice that its possible)
The Following User Says Thank You to broodplank1337 For This Useful Post: [ View ]
28th November 2012, 07:40 PM   |  #3  
lokeshsaini94's Avatar
Recognized Contributor / Themer
Flag Behind you!!!
Thanks Meter: 3,683
 
1,776 posts
Join Date:Joined: May 2012
Donate to Me
More
This can be usefull when you have others Using your phone then you can set password for main acc and when others ask your phone they can open guest account or other...
this will get better...

Sent from my GT-S7500 using xda premium
The Following User Says Thank You to lokeshsaini94 For This Useful Post: [ View ]
29th November 2012, 12:09 PM   |  #4  
rogro82's Avatar
OP Senior Recognized Developer
Thanks Meter: 440
 
862 posts
Join Date:Joined: May 2008
Donate to Me
More
Quote:
Originally Posted by broodplank1337

Cool, thanks for sharing! (Although, I think having more users on an android device is kinda useless, but very nice that its possible)

I used to agree about it being useless for phones, but I also share a family gmail account and I like having that completely seperated from my own user so that I don't have calendars etc mixed in one user.

And in case you only have one user everything is the same as without the multiple user ability so it kinda made sense just adding it and let the user decide.
The Following User Says Thank You to rogro82 For This Useful Post: [ View ]
2nd December 2012, 04:10 AM   |  #5  
runandhide05's Avatar
Recognized Contributor
Thanks Meter: 2,450
 
2,805 posts
Join Date:Joined: Apr 2011
Donate to Me
More
would someone do me a favor and attempt to make a phone call in a user profile that is not the main user, i added this in and i get fc when i attempt to make a call. just wondering what others are experiencing


Edit
So.I've had a few devs including myself add this to a quick build. All of us of different sources have the same issue and I would highly recommend not adding it because if someone had to dial out the phone FC when u press call
So imagine having to call 911. And you can't until your switch users... Probably not a good idea.
Its a great find. But that could cause some real problems
Last edited by runandhide05; 2nd December 2012 at 05:09 AM.
3rd December 2012, 01:52 AM   |  #6  
rogro82's Avatar
OP Senior Recognized Developer
Thanks Meter: 440
 
862 posts
Join Date:Joined: May 2008
Donate to Me
More
We have implemented this change in our AOSP build on the HTC One X without any issues.

If you could get me a logcat of the crash I can take a look, but I cant think it has to do with multi-user support as it is already baked into JB yet only 1 user is enabled by default.

Are you sure you have only added:
<integer name="config_multiuserMaximumUsers">8</integer>

to your config.xml and did not add anything else?
Last edited by rogro82; 3rd December 2012 at 01:55 AM.
3rd December 2012, 02:15 AM   |  #7  
runandhide05's Avatar
Recognized Contributor
Thanks Meter: 2,450
 
2,805 posts
Join Date:Joined: Apr 2011
Donate to Me
More
Quote:
Originally Posted by rogro82

We have implemented this change in our AOSP build on the HTC One X without any issues.

If you could get me a logcat of the crash I can take a look, but I cant think it has to do with multi-user support as it is already baked into JB yet only 1 user is enabled by default.

Are you sure you have only added:
<integer name="config_multiuserMaximumUsers">8</integer>

to your config.xml and did not add anything else?

Correct. And that was the only thing I changed. Keep in mind yes its built into aosp but only for phones. No log cat cause as soon as I ran into that problem I didn't bother to continue and just abandoned the changes. I did add the changes to aosp as well as a custom source and both had the same result as did a few other devs I had try it.
No worry's tho.
3rd December 2012, 02:19 AM   |  #8  
rogro82's Avatar
OP Senior Recognized Developer
Thanks Meter: 440
 
862 posts
Join Date:Joined: May 2008
Donate to Me
More
Quote:
Originally Posted by runandhide05

Correct. And that was the only thing I changed. Keep in mind yes its built into aosp but only for phones. No log cat cause as soon as I ran into that problem I didn't bother to continue and just abandoned the changes. I did add the changes to aosp as well as a custom source and both had the same result as did a few other devs I had try it.
No worry's tho.

K if you ever decide to give it another try and run into the same issue just post a logcat and ill be happy to look into it... as said we have this change applied in our aosp build and have no issues with calling or any other crash related to multi-user support
3rd December 2012, 02:20 AM   |  #9  
runandhide05's Avatar
Recognized Contributor
Thanks Meter: 2,450
 
2,805 posts
Join Date:Joined: Apr 2011
Donate to Me
More
Quote:
Originally Posted by rogro82

K if you ever decide to give it another try and run into the same issue just post a logcat and ill be happy to look into it... as said we have this change applied in our aosp build and have no issues with calling or any other crash related to multi-user support

OK I probably still have the zip laying around, I may through it on to.pull a log.
3rd December 2012, 02:36 AM   |  #10  
rogro82's Avatar
OP Senior Recognized Developer
Thanks Meter: 440
 
862 posts
Join Date:Joined: May 2008
Donate to Me
More
nvm i now know what you mean... trying to call with a user other then the device owner FCs... Ill see if that can be fixed

Just looking at Phone package source:
* Returns the singleton instance of the PhoneApp if running as the
* primary user, otherwise null.

So then it crashes because it has no PhoneGlobals for the non-primary user.

Most probably the Phone app does not support multi-users because it would register the broadcast receiver for handling calls multiple times... If this can be fixed easily I cant answer immediatly
Last edited by rogro82; 3rd December 2012 at 02:46 AM.

Post Reply Subscribe to Thread
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Top Threads in Android Software and Hacking General [Developers Only] by ThreadRank