How to run an apk with UID root

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


Sponsored Links
 Hi,

          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.

regards
KSK.



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
hack...@android.com

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. Intent to notify??

I was wondering if it was possible to have an intent that would fire
off a notification. I need this because I'm running a service that has
proximityAlerts registered on a LocationManager and I would like to
have it so that when one of these alerts is triggered, a notification
shows up in the status bar. I wish there was a way to just fire a
function rather than using an intent here, but I don't think there is.
Any help is appreciated!!

-- 

2. Couple questions regarding gestures and system uis



Yes, you can have a program start up on boot. That's OK if you are using
it to schedule tasks via AlarmManager or something. Trying to have
something run forever is not a good design move:

http://www.androidguys.com/2009/09/09/diamonds-are-forever-services-are-not/


You cannot just have a random thread floating around the ether. It needs
to be associated with some component (usually an activity or service).


Most "system events" are broadcast Intents. You do not need to have
anything start at boot or have any long-running threads for that. Just
set up BroadcastReceivers, registered in your manifest, that will get
control on those events and register Notifications.


If you do that, users will attempt to perform anatomically inappropriate
things to you. Users really dislike being interrupted in the middle of
their game, phone call, text message, browsing, etc.

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy

_The Busy Coder's Guide to *Advanced* Android Development_
Version 1.6 Available!

-- 

3. MovieViewControl unable to become a receiver during Broadcast.

4. How to tell if headphones are plugged in

5. Possible to customize a submenu?

6. stack trace not helping

7. Display multiple images from a remote source in a gallery (zoomable+pannable)