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/