How to run an apk with UID root

by ksk » Mon, 22 Feb 2010 06:36:44 GMT

Sponsored Links

          I have an application(apk) which normally gets uid as
app_16. Internally it calls a Shared library, which tries to write to
HCI socket(bluetooth socket). Here the socket which is created has
bluetooth UID and GID. It is not allowing to write to that socket.

Can any body give me suggestion what all permissions should be given
in manifest file to make it work. I have bluetooth and bluetooth admin
in Manifest file.

or Any thing should be added to framework such that my apk and library
gets permissions to aceeses HCI socket.


How to run an apk with UID root

by Dianne Hackborn » Mon, 22 Feb 2010 20:09:32 GMT

 Sorry, no .apk can run as root.  The android system is designed carefully to
run very few things as root, and that is way lower level than an .apk.  Not
even the system process (hosting the package manager, activity manager,
window manager, and various other essential system services) runs as root or
can cause something else to run as root.

Typically how device access is handled is by defining a uid that the device
is a group of and a permission in permissions.xml mapping to that uid, so an
.apk can use <uses-permission> to be included in that uid group.

Dianne Hackborn
Android framework engineer

Note: please don't send private questions to me, as I don't have time to
provide private support, and so won't reply to such e-mails.  All such
questions should be posted on public forums, where I and others can see and
answer them.

Sponsored Links

Other Threads

1. Why 'system' user cannot access /sdcard, follow-up question

I've seen the following explanation about why the system user is not
allowed to read/write the sdcard:

"The system user is not allowed to touch the SD card so that the
system does not get killed if the card is removed or unmounted."

I'm looking for some clarification on that statement. Does it mean
that the single process with UID system that is accessing the sdcard
will be killed or all processes running with the UID system will be
killed. Better yet, can someone point me to the code that will be
doing said killing.


2. linux "readahead" system call is not defind in android

Trying to use sreadahead tool on android target to decrease bootup
time .
But sreaahesd.c are not getting compiled against bionic library.
Below is the error message---------

/tmp/ccIfKOOt.o: In function `one_thread':
/home/zafar/spreadahead/sreadahead-1.0/sreadahead.c:177: undefined
reference to `__sync_fetch_and_add_4'
/tmp/ccIfKOOt.o: In function `readahead_one':
/home/zafar/spreadahead/sreadahead-1.0/sreadahead.c:166: undefined
reference to `readahead'
/tmp/ccIfKOOt.o: In function `one_thread':
/home/zafar/spreadahead/sreadahead-1.0/sreadahead.c:177: undefined
reference to `__sync_fetch_and_add_4'
collect2: ld returned 1 exit status
make: *** [sreadahead] Error 1

Linux readahead system is not defined in android and
__sync_fetch_and_add is X86 toolchain inbuilt memory access function.

Any way to port these two APIs( Readahead  and  __sync_fetch_and_add)

Any help will be highly appreciated

Thank you


3. Downloading App from store

4. Shared Heap concept in Android..

5. Pejing Lesjaw : andchat

6. hello HTC Incredible

7. Rom Magic 32A by ahmgsk untuk