Implementing a custom setting

33 views
Skip to first unread message

Andrei

unread,
Mar 24, 2014, 4:53:34 PM3/24/14
to android...@googlegroups.com
I've implemented a custom feature inside AudioFlinger that I want to be able to turn on and off. I am currently able to do it by reading a custom system properties (property_get()) and setting it from adb when running adb as root.

If I understand things correctly, Android security architecture does not allow me to modify these properties (property_set()) from an app, e.g. Setting or a custom app, even if I compile the app with the system UID and sign it the system signing identity. The reason is that I need to be root, not system, in order to set them for AudioFlinger to see. (Can someone confirm this?) So I'm abandoning this strategy.

Instead, I'm thinking for using a named semaphore in the OS which would wait for the app the toggle a switch and then set the appropriate setting. This seems like a bit of an overkill.

What is the way to implement this correctly? Is there an event API that the OS code itself could listen to, similar to BroadcastListener in Dalvik? Any feedback is much appreciated.

Zoltan Kuscsik

unread,
Mar 25, 2014, 4:04:36 AM3/25/14
to android...@googlegroups.com

Hi Andrei,

there are two approaches you could take. Create a binder interface for your extension or use the system property settings.
The property service defines permissions for various properties, based on the prefix of the property name. You can find them
in the following file:

system/core/init/property_service.c

By default in the adb shell you are running under the "shell" user, so you need to define properties matching the AID_SHELL 
permission. In KitKat you could use for example "setprop debug.my_awasome_feature 1"
Reply all
Reply to author
Forward
0 new messages