If we want to get some system property programatically, we can use either of the following 2 options
Using the sample app, I observed that option#1(took 1msec) is very faster than option#2(13msecs). I understand that this happens because in option#2, a entirely new process will be spawned by JVM to execute the command.
Definitely many programmers tend to use option#1 for better performance reasons.
But, as mentioned in https://developer.android.com/about/versions/pie/restrictions-non-sdk-interfaces, starting with Android P, android is blocking using non_SDK interfaces.
so, without using reflection, is there any way to get the system propertiy as fast as getting property with reflection?
Does google recommend any efficient alternative to SystemProperties reflection and getprop methods for getting system properties??
--
You received this message because you are subscribed to the Google Groups "android-platform" group.
To unsubscribe from this group and stop receiving emails from it, send an email to android-platfo...@googlegroups.com.
To post to this group, send email to android-...@googlegroups.com.
Visit this group at https://groups.google.com/group/android-platform.
For more options, visit https://groups.google.com/d/optout.
Thanks florian for the suggestion.
In http://androidxref.com/9.0.0_r3/xref/bionic/libc/include/sys/system_properties.h, there is a comment "Deprecated" on top of the function declaration of __system_property_get. Does it mean, it is going to be deprecated in near future?
On Mon, Sep 17, 2018 at 11:10 PM <florian....@inovex.de> wrote:
You could perhaps use native code, have a look at $ANDROID_SDK_ROOT/ndk-bundle/sysroot/usr/include/sys/system_properties.h.--
On Saturday, September 15, 2018 at 12:39:04 AM UTC+2, pendyala syam wrote:If we want to get some system property programatically, we can use either of the following 2 options
- Use reflection to get android.os.SystemProperties class and call get method with key.
- call adb shell command "getprop" using Runtime exec.
Using the sample app, I observed that option#1(took 1msec) is very faster than option#2(13msecs). I understand that this happens because in option#2, a entirely new process will be spawned by JVM to execute the command.
Definitely many programmers tend to use option#1 for better performance reasons.
But, as mentioned in https://developer.android.com/about/versions/pie/restrictions-non-sdk-interfaces, starting with Android P, android is blocking using non_SDK interfaces.
so, without using reflection, is there any way to get the system propertiy as fast as getting property with reflection?
Does google recommend any efficient alternative to SystemProperties reflection and getprop methods for getting system properties??
You received this message because you are subscribed to the Google Groups "android-platform" group.
To unsubscribe from this group and stop receiving emails from it, send an email to android-...@googlegroups.com.