How to create a new System Property ?

4,968 views
Skip to first unread message

FrankG

unread,
Apr 9, 2010, 4:03:42 AM4/9/10
to android-platform
Dear all,

something went wrong with this posting from me, so sorry, if you get
this twice.

We would like to create a new system property to communicate with from
user space with the kernel and init.rc
( and use the on property feature ).

Something like persist.service.adb.enable.

We can see, that i.e. SystemServer.java uses SystemProperties.set. But
if we tried this from a signed ( platform )
system app, we cannot see the new property in the adb shell with
getprop.

So what are the required steps ?

Thanks a lot for any hint.

Frank

FrankG

unread,
Apr 12, 2010, 4:41:51 AM4/12/10
to android-platform
Dear all,

Seems for me, with setprop I can create new system properties ..

But how to make them a "persist" -one ?

And how to initialize the default values during boot time ?

Thanks for any kind hint.

Frank

On 9 Apr., 10:03, FrankG <frankgru...@googlemail.com> wrote:
> Dear all,
>
> something went wrong with this posting from me, so sorry, if you get
> this twice.
>

> We would like to create a newsystemproperty to communicate with from


> user space with the kernel and init.rc
> ( and use the on property feature ).
>
> Something like persist.service.adb.enable.
>
> We can see, that i.e. SystemServer.java uses SystemProperties.set. But

> if we tried this from a signed  ( platform )systemapp, we cannot see the new property in the adb shell with

FrankG

unread,
Apr 15, 2010, 3:41:23 PM4/15/10
to android-platform

What a pity ! So far I got no hint.

Has really noone done this before ?

Thanks a lot !

Frank

Anthony

unread,
Apr 15, 2010, 4:45:10 PM4/15/10
to android-...@googlegroups.com
People have done it before :)

If you want it to be around all the time, unchanged you could put it in init.rc.

e.g.

setprop ro.foobar 1234

init.rc has plenty of other property examples.

You can also run `getprop` in your shell to see a list of properties
that you can then search your source for.

> --
> 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.
>
>

FrankG

unread,
Apr 16, 2010, 10:47:18 AM4/16/10
to android-platform

Hallo Anthony,

Thanks for your answer.

On 15 Apr., 22:45, Anthony <m.bn...@gmail.com> wrote:
> People have done it before :)
>
> If you want it to be around all the time, unchanged you could put it in init.rc.

No, I want, that it can be changed by a system app .. exactly like
persist.service.adb.enable.

> e.g.
>
> setprop ro.foobar 1234
>
> init.rc has plenty of other property examples.

Yes, but it only uses setprop with read only properties ..

i.e. persist.service.adb.enable is not introduced in init.rc, but it
is used their via

on property:persist.service.adb.enable=1

So where it comes from ? Where is persist.service.adb.enable
introduced ?

It seems for me, that I need to "introduce" my own system properties
somehow, that I can change them
via SystemProperties.set and react on this changes in init.rc ..

This is what I want to do.

If I "create" a new System Property directly from a SystemApp via
SystemProperties.set I can't see them with getprop.

What definitly works is the pair setprop/getprop ..

Theirfore you are right, that I can introduce new ones via setprop ..
but this is not what I can use.I cannot set them in init.rc, because
I need to do start something at kernel level dependent from this
SystemProperty.

But when I look once more it seems that i.e.
persist.service.adb.enable is introduced via default.prop.

Thanks for any hint !
Reply all
Reply to author
Forward
0 new messages