@Override public void handleMessage(Message msg) { if (!pref.isTestCanceled() && pref.isTestRunning()) { L.debug("DownloadAndUploadCompletedHandler..."); pref.setFTPTestRunningState(false); // testconfig.getTestName() new ResultUploader( context, pref.getValue(Preferences.KEY_TEST_NAME, "") + StringUtils.TEST_CYCLE_APPEND_FILE + testconfig.getTestCycle(), StringUtils.TEST_TYPE_CODE_FTP, settings.getFTPDeviceInfoPath(), settings.getFTPLogcatPath()) { public void resultUploaded(String code, String desc) { doResultUploaded(code, desc); }; }; } }
@Override public void handleMessage(Message msg) { // ################### String sResponseCode = msg.getData().getString(StringUtils.CODE); String sResponseDesc = msg.getData().getString(StringUtils.DESC); clearFTPFiles(); if (sResponseCode.equals(ResponseCodes.SUCCESS)) { L.debug("File download and upload success"); } else { L.debug(sResponseDesc); if (!pref.isTestCanceled() && pref.isTestRunning()) { L.debug("RunnableFailed..."); pref.setFTPTestRunningState(false); /* * NotificationUtil.showFinishedNotification( context, * StringUtils.TEST_TYPE_CODE_FTP, testconfig.getTestName() * + "_" + testconfig.getTestCycle(), * Messages.FTP_DOWNLOAD_FAILED); */ NotificationUtil.showFinishedNotification( context, StringUtils.TEST_TYPE_CODE_FTP, pref.getValue(Preferences.KEY_TEST_NAME, "") + "_" + testconfig.getTestCycle(), Messages.FTP_DOWNLOAD_FAILED); DeviceUtil.updateTestScreen(); doResultUploaded(sResponseCode, sResponseDesc); } } }
public void startTest() { deviceOSVersion = android.os.Build.VERSION.SDK_INT; L.debug("DEVICE OS VERSION: " + deviceOSVersion); FTPTestConfigObj = testconfig.getFTPTestConfig(); /* * * String sTestName = testconfig.getTestName() + * StringUtils.TEST_CYCLE_APPEND_FILE + testconfig.getTestCycle(); */ String sTestName = pref.getValue(Preferences.KEY_TEST_NAME, "") + StringUtils.TEST_CYCLE_APPEND_FILE + testconfig.getTestCycle(); pref.setFTPTestRunningState(true); DeviceUtil dv = new DeviceUtil(context); String sDeviceInfoXML = dv.getDeviceInfo( StringUtils.FILE_CODE_TEST_TYPE_FTP, sTestName, pref.getUsername(), pref.getValue(Preferences.KEY_SELECTED_MARKET_PLACE_ID, "")); L.debug(sDeviceInfoXML); String sCurrTime = TimeUtil.getCurrentTimeFilename(); FileUtil.CURRENT_FTP_TESTTIME = sCurrTime; String path = FileUtil.FTP_LOG_DIR + "deviceinfo" + "_" + sTestName + "_" + sCurrTime + ".xml"; File fle = new File(path); if (fle.exists()) { fle.delete(); } String dev_info_path = FileUtil.writeToXMLFile(path, sDeviceInfoXML); L.debug("Device info initial data written into " + dev_info_path); pref.putValue(Preferences.KEY_CURRENT_FTP_DEV_INFO_PATH, dev_info_path); String logcat_path = FileUtil.FTP_LOG_DIR + StringUtils.FILE_CODE_TEST_TYPE_FTP + "_" + dv.getIMEI() + "_" + sTestName + "_" + sCurrTime + ".txt"; L.debug("!!! logcat_path !!!!: " + logcat_path); File log_fle = new File(logcat_path); try { log_fle.createNewFile(); } catch (IOException e) { } pref.putValue(Preferences.KEY_CURRENT_FTP_LOGCAT_PATH, log_fle.getAbsolutePath()); try { Airometric app = (Airometric) context.getApplication(); app.startListeners(dev_info_path); } catch (Exception e) { e.printStackTrace(); } NotificationUtil.cancelNotification(context, StringUtils.TEST_TYPE_CODE_FTP); uploadTask = new StartTestTask(); uploadTask.execute(); Constants.CurrentTask = uploadTask; NotificationUtil.showRunningNotification(context, StringUtils.TEST_TYPE_CODE_FTP); context.showActivity(TestTypeActivity.class); }