unsetting persistent system properties

2019-02-01 01:59发布

I can set a persistent system property on an Android phone (with appropriate permissions) using setprop <key> <value> command:

$ adb shell setprop persist.this.is.my.property testing

I can then confirm that the property was set:

$ adb shell getprop persist.this.is.my.property
testing

But I can't remove the key now that it is set (because of the persist at the start of the key it is there after the phone reboots). There is no unsetprop or rmprop or anything similar. Attempting to set the value to nil or null sets that to the value and leaving it empty prompts the help instructions.

Does anyone know how to unset a system property from the command line after it has been set?

5条回答
家丑人穷心不美
2楼-- · 2019-02-01 02:23

It works for me.
on macOS:
echo -e "setprop wrap.$PACKAGE_NAME \"\"\n exit" > .temp adb shell < .temp rm ./.temp

on android:
setprop wrap.$PACKAGE_NAME ""

查看更多
虎瘦雄心在
3楼-- · 2019-02-01 02:27

To remove the property:

rm /data/property/persist.this.is.my.property && reboot
查看更多
霸刀☆藐视天下
4楼-- · 2019-02-01 02:47
adb shell setprop persist.this.is.my.property \"\"
adb shell reboot

Changed the property value so it wouldn't be using it's previous value.
Empty quotes("") wouldnt work for me, I had to escape them(this is in bash).

查看更多
一夜七次
5楼-- · 2019-02-01 02:47

Just reboot the device, the property will unset.

查看更多
可以哭但决不认输i
6楼-- · 2019-02-01 02:49

You can remove the property with adb shell setprop persist.this.is.my.property ""

查看更多
登录 后发表回答