@Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    if (ModuleTestApplication.LOG_ENABLE) {
      try {
        mLogWriter = new FileWriter(ModuleTestApplication.LOG_DIR + "/ModuleTest/log_vibrator.txt");
      } catch (IOException e) {
        e.printStackTrace();
      }
      ModuleTestApplication.getInstance().recordLog(null);
    }
    Log.i(ModuleTestApplication.TAG, "---Vibrator Test---");

    setContentView(R.layout.vibrator_test);

    mVibrator = (Vibrator) getSystemService(VIBRATOR_SERVICE);
    if (mVibrator == null) postError("In onCreate():Get VIBRATOR_SERVICE failed");
    if (!mVibrator.hasVibrator()) {
      NuAutoTestAdapter.getInstance()
          .setTestState(
              getString(R.string.vibrator_test), NuAutoTestAdapter.TestState.TEST_STATE_FAIL);
      this.finish();
    }
  }
 @Override
 public void onDestroy() {
   if (ModuleTestApplication.LOG_ENABLE) {
     ModuleTestApplication.getInstance().recordLog(mLogWriter);
     try {
       mLogWriter.close();
     } catch (IOException e) {
       e.printStackTrace();
     }
   }
   super.onDestroy();
 }