Trouble adding vendor AIDs

552 views
Skip to first unread message

Eric Crahen

unread,
May 13, 2019, 3:25:58 PM5/13/19
to Android Building
I've been attempting to add some custom user for an application in my AOSP build, 

Following the notes here, I tried to add a custom vendor AID to my AOSP build

I thought I'd find an /etc/passwd entry somewhere with a mapping of the uid 2222 -> vendor_foobar (or maybe to just a user named foobar). Maybe I'm missing something from the notes linked above, but that's not happening. It seems like the new user isn't getting added to either the system.img or vendor.img


config.fs:
  [AID_VENDOR_FOOBAR]
  value: 2222

additions to BoardConfig.mk:
  TARGET_FS_CONFIG_GEN += device/google/muskie/walleye/config.fs
  TARGET_ANDROID_FILESYSTEM_CONFIG_H :=


Does anyone know how to correctly add a custom vendor AID? Thanks!

Tom Cherry

unread,
May 13, 2019, 3:44:53 PM5/13/19
to Android Building
It should be installed to /vendor/etc/passwd and /vendor/etc/group.

I'd also be careful that TARGET_FS_CONFIG_GEN isn't overwritten anywhere.  The BoardConfig.mk's for most of the google products specify this with a string similar to "TARGET_FS_CONFIG_GEN := device/google/wahoo/config.fs" so the := may overwrite what you've used.

Eric Crahen

unread,
May 13, 2019, 9:36:46 PM5/13/19
to Android Building
Thanks,

With that, I've been able to see my /system/etc/passwd file contains the generated AID now. That's great.

$ cat /system/etc/passwd
...
vendor_foobar::2222:2222::/:/system/bin/sh

Now, I'm trying to use this user. Is there a mapping from this vendor_foobar unix user-name to an android:sharedUserId attribute in an app/services AndroidManifest.xml? I was hoping to use something like:

<manifest
    android:sharedUserId="android.uid.vendor_foobar"
    ...>

or 

<manifest
    android:sharedUserId="android.uid.foobar"
    ...>

to connect an application to this user. Those examples above didn't work, the application ran as one of the generated users (e.g. u0_a167) which seems to be the default behavior if you set android:sharedUserId to some unrecognized value.

Is there an additional configuration needed to establish a binding to android:sharedUserId?

Shakir Mohammed

unread,
May 30, 2019, 10:34:19 AM5/30/19
to Android Building
Hi,
I have used some other method to create custom AIDs.
Initially, modifed the <AOSP>/system/core/include/private/android_filesystem_config.h file and added my custom AID_NEW within OEM_RESERVED region. Then I have modified <AOSP>/framework/base/core/res/AndroidManifest.xml and added a new andorid.permission variable. Then modified the <AOSP>/framework/base/data/etc/platform.xml and assigned the created AID to custom android.permission variable.

Is this method is having trouble. If so, what is the recommended method.

Also, is there any way to create a custom andriod:sharedUserId like system.uid.myuid, with my custom AID value.
Reply all
Reply to author
Forward
0 new messages