adb 重启Android framework
前言
Android调试时,有序需要修改系统的属性。使用adb shell setprop xxxx 后,重启机器后就恢复了。
然后实际中,有些属性如果没重启,会遇到属性值在代码中不生效,重启后,属性值又还原的问题。
比如SurfaceView的一个日志打印DEBUG开关,通过adb改变debug.surfaceview.log属性值后需要重启才有效。
SurfaceView中的DEBUG
public class SurfaceView extends View implements ViewRootImpl.WindowStoppedCallback { private static final String TAG = "SurfaceView"; private static final boolean DEBUG = SystemProperties.getBoolean( "debug.surfaceview.log", false); ...... }
解决上面方法有如下两种:
改SurfaceView找那个的DEBUG的值为true
缺点就是SurfaceView的日志一直开放着,无法关闭。
通过adb修改debug.surfaceview.log的默认属性,机器断电后恢复默认。
缺点:需要重启SurfaceView,也就是framework
优点:方便可控,断电即恢复默认。
相关文章
暂无评论...