if (!LeakCanaryWithoutDisplay.isInAnalyzerProcess(this)) {
// This process is dedicated to LeakCanary for heap analysis.
// You should not init your app inthis process.
LeakCanaryWithoutDisplay.install(this);
}
@echo off
cls
title 别忘了跑monkey啊
:menu
cls
color 0A
echo.
echo1.禁用systemui并重启
echo.
echo2.启用systemui并重启
echo.
echo q.退出
echo.
:cho
set choice=
set /p choice= 请选择:
IFNOT "%choice%"=="" SET choice=%choice:~0,1%if /i "%choice%"=="1" goto disable
if /i "%choice%"=="2" goto enable
if /i "%choice%"=="Q" exitecho 选择无效,请重新输入
echo.
goto cho
:disable
adb shell "su -c" pm disable com.android.systemui
adb shell reboot
pause&exit
:enable
adb shell "su -c" pm enable com.android.systemui
adb shell reboot
pause&exit
2.屏蔽音量、返回等按键,在BaseActivity中加入如下代码,测试时打开,不测试时注释掉。
/**monkey 测试屏蔽按键*/@OverridepublicbooleanonKeyDown(int keyCode, KeyEvent event) {
switch(keyCode){
case KeyEvent.KEYCODE_HOME:returntrue;
case KeyEvent.KEYCODE_CALL:returntrue;
case KeyEvent.KEYCODE_SYM: returntrue;
case KeyEvent.KEYCODE_VOLUME_DOWN: returntrue;
case KeyEvent.KEYCODE_VOLUME_UP: returntrue;
case KeyEvent.KEYCODE_STAR: returntrue;
case KeyEvent.KEYCODE_POWER: returntrue;
}
returnsuper.onKeyDown(keyCode, event);
}