Android System Properties Systemproperties

Source: Internet
Author: User

Create and modify Android properties with Systemproperties.set (name, value)

Get Android Properties with Systemproperties.get (name)

Note : The name of the Android attribute is in a certain format, as follows: prefix must be used System\core\init\property_ SERVICE.C the prefix defined in the system, the program that is set up for the property must also have the systems or root permissions

Ways to Elevate to system permissions:

1, in the androidmanifest.xml, in Manifest added android:shareduserid= "Android.uid.system"

2, in the Android.mk, will local_certificate: = XXX modified into local_certificate: =platform

Android's system properties include two parts: the persistent properties of the file save and the cache property of each boot import.

The former is mainly stored in the following files:

Bionic/libc/include/sys/_system_properties.h

#define PROP_SERVICE_NAME "Property_service" #define Prop_path_ramdisk_default  "/default.prop" #define Prop_path _system_build "     /system/build.prop" #define Prop_path_system_default   "/system/default.prop" #define PROP_ Path_local_override   "/data/local.prop"

The latter is defined by the Frameworks/base/core/java/android/os/systemproperties.java interface,

Private Static nativestring Native_get (string key); Private Static nativestring Native_get (String key, String def); Private Static native voidNative_set (String key, String def);  Public Static voidset (String key, String val) {if(Key.length () >Prop_name_max) {          Throw NewIllegalArgumentException ("Key.length >" +Prop_name_max); }       if(val! =NULL&& val.length () >Prop_value_max) {         Throw NewIllegalArgumentException ("Val.length >" +Prop_value_max);} Native_set (Key, Val);}

ADB sets the system properties and gets the System Properties command as follows (ADB requires root permission to set success):

ADB shell SetProp persist.panel.orientation 90

ADB Shell Getprop persist.panel.orientation

Android System Properties Systemproperties

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.