Android走Monkey必須コード

927 ワード

Monkeyがステータスバーをクリックすることを防止し、仮想ボタン
まず、携帯電話の全画面ダイナミック非表示ステータスバーと仮想ボタン(本人はnexus 6 pを使用)
adb shell settings put global policy_control immersive.full=*
リカバリ:adb shell settings put global policy_control null
次に、ボリュームキー戻りキーなどのイベントをキャンセルします(ボリュームキーを押して設定画面に入るのを防止するなど).
  @Override
    public boolean onKeyDown(int keyCode, KeyEvent event) {
        switch(keyCode){
            case KeyEvent.KEYCODE_HOME:return true;
            case KeyEvent.KEYCODE_BACK:return true;
            case KeyEvent.KEYCODE_CALL:return true;
            case KeyEvent.KEYCODE_SYM: return true;
            case KeyEvent.KEYCODE_VOLUME_DOWN: return true;
            case KeyEvent.KEYCODE_VOLUME_UP: return true;
            case KeyEvent.KEYCODE_STAR: return true;
        }
        return super.onKeyDown(keyCode, event);
    }

次の操作を開始できます.
adb shell monkey -p ***.***.*** -vvv 1000 > monkey1000.txt