diff --git a/src/com/netease/qa/emmagee/activity/MainPageActivity.java b/src/com/netease/qa/emmagee/activity/MainPageActivity.java index 9b7bd99..79d617e 100644 --- a/src/com/netease/qa/emmagee/activity/MainPageActivity.java +++ b/src/com/netease/qa/emmagee/activity/MainPageActivity.java @@ -62,7 +62,7 @@ public class MainPageActivity extends Activity { private List processList; private ProcessInfo processInfo; - private Intent MonitorService; + private Intent monitorService; private ListView lstViProgramme; private Button btnTest; private boolean isTesting = true; @@ -86,8 +86,8 @@ public void onCreate(Bundle savedInstanceState) { btnTest.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { - MonitorService = new Intent(); - MonitorService.setClass(MainPageActivity.this, + monitorService = new Intent(); + monitorService.setClass(MainPageActivity.this, EmmageeService.class); if (isTesting) { if (isRadioChecked) { @@ -96,13 +96,13 @@ public void onClick(View v) { Log.d(LOG_TAG, packageName); startActivity(intent); waitForAppStart(packageName); - MonitorService.putExtra("processName", processName); - MonitorService.putExtra("pid", pid); - MonitorService.putExtra("uid", uid); - MonitorService.putExtra("packageName", packageName); - MonitorService.putExtra("settingTempFile", + monitorService.putExtra("processName", processName); + monitorService.putExtra("pid", pid); + monitorService.putExtra("uid", uid); + monitorService.putExtra("packageName", packageName); + monitorService.putExtra("settingTempFile", settingTempFile); - startService(MonitorService); + startService(monitorService); btnTest.setText("停止测试"); isTesting = false; } else { @@ -115,14 +115,14 @@ public void onClick(View v) { Toast.makeText(MainPageActivity.this, "测试结果文件:" + EmmageeService.resultFilePath, Toast.LENGTH_LONG).show(); - stopService(MonitorService); + stopService(monitorService); } } }); } /** - * create new file to reserve setting data + * create new file to reserve setting data. */ private void createNewFile() { Log.i(LOG_TAG, "create new file to save setting data"); @@ -174,6 +174,10 @@ private void waitForAppStart(String packageName) { /** * show a dialog when click return key. + * + * @return Return true to prevent this event from being propagated further, + * or false to indicate that you have not handled this event and it + * should continue to be propagated. */ public boolean onKeyDown(int keyCode, KeyEvent event) { if (keyCode == KeyEvent.KEYCODE_BACK && event.getRepeatCount() == 0) { @@ -183,8 +187,8 @@ public boolean onKeyDown(int keyCode, KeyEvent event) { } /** - * set menu options. - * + * set menu options,including cancel and setting options. + * * @return true */ public boolean onCreateOptionsMenu(Menu menu) { @@ -197,7 +201,7 @@ public boolean onCreateOptionsMenu(Menu menu) { /** * trigger menu options. - * + * * @return false */ public boolean onOptionsItemSelected(MenuItem item) { @@ -219,7 +223,7 @@ public boolean onOptionsItemSelected(MenuItem item) { /** * create a dialog. - * + * * @return a dialog */ protected Dialog onCreateDialog(int id) { @@ -233,9 +237,9 @@ protected Dialog onCreateDialog(int id) { @Override public void onClick(DialogInterface dialog, int which) { - if (MonitorService != null) { + if (monitorService != null) { Log.d(LOG_TAG, "stop service"); - stopService(MonitorService); + stopService(monitorService); } Log.d(LOG_TAG, "exit Emmagee"); EmmageeService.closeOpenedStream(); @@ -250,7 +254,7 @@ public void onClick(DialogInterface dialog, /** * customizing adapter. - * + * */ private class ListAdapter extends BaseAdapter { List programe; diff --git a/src/com/netease/qa/emmagee/activity/SettingsActivity.java b/src/com/netease/qa/emmagee/activity/SettingsActivity.java index 601d71b..6fa4103 100644 --- a/src/com/netease/qa/emmagee/activity/SettingsActivity.java +++ b/src/com/netease/qa/emmagee/activity/SettingsActivity.java @@ -59,7 +59,7 @@ public void onCreate(Bundle savedInstanceState) { edtTime = (EditText) findViewById(R.id.time); Button btnSave = (Button) findViewById(R.id.save); boolean floatingTag = true; - RandomAccessFile raf ; + RandomAccessFile raf; try { raf = new RandomAccessFile(settingTempFile, "r"); @@ -81,7 +81,6 @@ public void onCreate(Bundle savedInstanceState) { Log.e(LOG_TAG, "IOException: " + e.getMessage()); e.printStackTrace(); } - edtTime.setText(time); chkFloat.setChecked(floatingTag); // edtTime.setInputType(InputType.TYPE_CLASS_NUMBER); @@ -135,7 +134,7 @@ protected void onDestroy() { /** * is input a number. - * + * * @param inputStr * input string * @return true is numeric diff --git a/src/com/netease/qa/emmagee/service/EmmageeService.java b/src/com/netease/qa/emmagee/service/EmmageeService.java index dd24186..a621e87 100644 --- a/src/com/netease/qa/emmagee/service/EmmageeService.java +++ b/src/com/netease/qa/emmagee/service/EmmageeService.java @@ -157,7 +157,7 @@ private void readSettingInfo(Intent intent) { time = "5"; isFloating = true; Log.e(LOG_TAG, e.getMessage()); - } + } } /** @@ -300,9 +300,9 @@ public void run() { /** * refresh the performance data showing in floating window. - * + * * @throws FileNotFoundException - * + * * @throws IOException */ private void dataRefresh() { diff --git a/src/com/netease/qa/emmagee/utils/CpuInfo.java b/src/com/netease/qa/emmagee/utils/CpuInfo.java index d4c9a22..9fd2838 100644 --- a/src/com/netease/qa/emmagee/utils/CpuInfo.java +++ b/src/com/netease/qa/emmagee/utils/CpuInfo.java @@ -148,7 +148,7 @@ public ArrayList getCpuRatioInfo() { String mDateTime2 = formatterFile.format(cal.getTime().getTime() + 8 * 60 * 60 * 1000); - if (isInitialStatics == true) { + if (isInitialStatics) { initialTraffic = trafficInfo.getTrafficInfo(); isInitialStatics = false; } else { diff --git a/src/com/netease/qa/emmagee/utils/MemoryInfo.java b/src/com/netease/qa/emmagee/utils/MemoryInfo.java index 5004ff9..a6bdfbf 100644 --- a/src/com/netease/qa/emmagee/utils/MemoryInfo.java +++ b/src/com/netease/qa/emmagee/utils/MemoryInfo.java @@ -90,7 +90,7 @@ public int getPidMemorySize(int pid, Context context) { int[] myMempid = new int[] { pid }; Debug.MemoryInfo[] memoryInfo = am.getProcessMemoryInfo(myMempid); memoryInfo[0].getTotalSharedDirty(); - + // int memSize = memoryInfo[0].dalvikPrivateDirty; // TODO PSS int memSize = memoryInfo[0].getTotalPss(); @@ -100,7 +100,7 @@ public int getPidMemorySize(int pid, Context context) { /** * get the sdk version of phone. - * + * * @return sdk version */ public String getSDKVersion() { @@ -109,7 +109,7 @@ public String getSDKVersion() { /** * get phone type. - * + * * @return phone type */ public String getPhoneType() { diff --git a/src/com/netease/qa/emmagee/utils/ProcessInfo.java b/src/com/netease/qa/emmagee/utils/ProcessInfo.java index 7755220..7fea6c0 100644 --- a/src/com/netease/qa/emmagee/utils/ProcessInfo.java +++ b/src/com/netease/qa/emmagee/utils/ProcessInfo.java @@ -38,7 +38,7 @@ public class ProcessInfo { /** * get information of all running processes,including package name ,process * name ,icon ,pid and uid. - * + * * @param context * context of activity * @return running processes list @@ -83,7 +83,7 @@ public List getRunningProcess(Context context) { /** * get information of all applications. - * + * * @param context * context of activity * @return packages information of all applications diff --git a/src/com/netease/qa/emmagee/utils/TrafficInfo.java b/src/com/netease/qa/emmagee/utils/TrafficInfo.java index b575849..c32b01e 100644 --- a/src/com/netease/qa/emmagee/utils/TrafficInfo.java +++ b/src/com/netease/qa/emmagee/utils/TrafficInfo.java @@ -36,7 +36,7 @@ public TrafficInfo(String uid) { /** * get total network traffic, which is the sum of upload and download * traffic. - * + * * @return total traffic include received and send traffic */ public long getTrafficInfo() {