Getprop: get Android system attributes

Source: Internet
Author: User

In the Android system, its root file system has several configuration files required for starting the system:

/Init. RC

/Default. Prop

/System/build. Prop

Generally, we can get it through the getprop command and set setprop.

Before using these two commands, let's take a look at what is in build. Prop:

ADB shell cat build. Prop

The result is as follows:

(Only some of them are listed)

GPS. solution. Combo. Chip = 1
Fmradio. Driver. Chip = 1
Ro. SF. hwrotation = 0
RIL. Current. Sort _modem = 1
Launcherplus. all1_grid = 2D
Launcher2.all1_grid = 3d_20
Curlockscreen = 2

Obviously, the data stored in this file is stored in the form of equal signs, and they are paired with key-value pairs.

Now let's take a look at the getprop results:

[Ro. Revision]: [0]
[Ro. runtime. firstboot]: [1347574848005]
[Ro. Secure]: [0]
[Ro. serialno]: [0123456789 abcdef]
[Ro. SF. hwrotation]: [0] # consistent with the above value
[Ro. SF. LCD _density]: [240]
[Ro. SYS. USB. MTP. WHQL. Enable]: [0]
[Ro. SYS. USB. Storage. Type]: [MTP, mass_storage]

Therefore, getprop reads and sorts the information in the configuration file, and displays the information in a dictionary.

The format is as follows:

Getprop[Key] gets the attribute value of the corresponding key

GetpropList all configuration property values

To modify attributes, you only need to modify the dictionary value, as shown in figure

Setprop [Key] [value]Set the attribute value of the specified key.

Watchprops Listen for system attribute changes. If the system attribute changes during this period, the changed value will be displayed. In fact, these three commands are all toolbox subcommands, if you are interested, you can see the corresponding source code in the android source code: System/CORE/toolbox/
Related Article

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.