What makes a system property persistent ?

8,509 views
Skip to first unread message

FrankG

unread,
May 3, 2010, 3:19:46 PM5/3/10
to android-platform
Dear all,

I can set a system property via set_prop i.e. a adb shell and can ask
for this property via get_prop.

But what makes a property persistent ?

Some of the persistent properties are introduced via the Variable
ADDITIONAL_DEFAULT_PROPERTIES in
an core/main.mk , but no idea who uses this Variáble and what happens
with them.

Some are set by default.prop, but what is the story behind them ?

I cannot simply change default.prop, as it seem the be rewritten after
reboot.

So how make my own persistent property ?

Thanks a lot !

Frank

--
You received this message because you are subscribed to the Google Groups "android-platform" group.
To post to this group, send email to android-...@googlegroups.com.
To unsubscribe from this group, send email to android-platfo...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/android-platform?hl=en.

Mike Lockwood

unread,
May 3, 2010, 3:58:50 PM5/3/10
to android-...@googlegroups.com
System properties are automatically persistent across reboots if their
name begins with "persist." But it sounds like you are just having
trouble setting the system properties due to permission problems.
Most system properties can only be written by root, while some can be
written by certain users like system (for the system server process)
or radio (for the RIL or phone app). In general you can not write
system properties unless you are a privileged user.

Mike
--
Mike Lockwood
Google android team

FrankG

unread,
May 3, 2010, 5:11:49 PM5/3/10
to android-platform
Thanks a lot Mike, for your fast answer.

I need this for a vendor extension, so I can modify
also part of the platform themselve and can also be
privileged user.

What I need is a) introduce a new persistent variable
and b) able to change them from a java system service and
from a modified version of Settings-App.
Where do I declare that a certain system property exists or even
better to say,
where must I introduce my own system property ?

Thanks a lot !

Frank



> > For more options, visit this group athttp://groups.google.com/group/android-platform?hl=en.
>
> --
> Mike Lockwood
> Google android team
>
> --
> You received this message because you are subscribed to the Google Groups "android-platform" group.
> To post to this group, send email to android-...@googlegroups.com.
> To unsubscribe from this group, send email to android-platfo...@googlegroups.com.
> For more options, visit this group athttp://groups.google.com/group/android-platform?hl=en.- Zitierten Text ausblenden -
>
> - Zitierten Text anzeigen -

Mike Lockwood

unread,
May 3, 2010, 5:25:18 PM5/3/10
to android-...@googlegroups.com
You don't need to declare the property anywhere in advance before
setting it. You can use default.prop to set an initial value in the
build if you want, but that is not a requirement. Otherwise, the
property is undefined until someone calls property_set to give it a
value.

By default only root can set a system property. But if you need to
set it from some other process, you can change the property_perms[]
table in system/core/init/property_service.c to allow another process
to write it. Or better yet, use one of the existing prefixes in the
table if it makes sense instead.

Mike

FrankG

unread,
May 4, 2010, 2:15:47 AM5/4/10
to android-platform
Hello Mike,

Thanks a lot. Verry kind of you .

I think with your answer I have now the missing details.

Have a nice day ! Frank
> >> For more options, visit this group athttp://groups.google.com/group/android-platform?hl=en.-Zitierten Text ausblenden -
Reply all
Reply to author
Forward
0 new messages