def _on_answer(self, instance, answer): if answer == "yes": phone_info = main_utils.get_phone_info() log_name = "crash_report_" \ + phone_info + '_' \ + datetime.datetime.now().strftime('%Y%m%d_%H%M%S') \ + '.txt' log_name = os.path.join( main_utils.get_mobileinsight_crash_log_path(), log_name) main_utils.run_shell_cmd( 'logcat -d | grep -E "python|diag" >' + log_name, True) self.__upload_crash_log(log_name) self.popup.dismiss() sys.exit(1)
def create_folder(): cmd = "" mobileinsight_path = main_utils.get_mobileinsight_path() if not mobileinsight_path: return False try: legacy_mobileinsight_path = main_utils.get_legacy_mobileinsight_path() cmd = cmd + "mv " + legacy_mobileinsight_path + " " + mobileinsight_path + "; " cmd = cmd + "mv " + legacy_mobileinsight_path + "/apps/ " + mobileinsight_path + "/plugins/; " except: pass if not os.path.exists(mobileinsight_path): cmd = cmd + "mkdir " + mobileinsight_path + "; " cmd = cmd + "chmod -R 755 " + mobileinsight_path + "; " log_path = main_utils.get_mobileinsight_log_path() if not os.path.exists(log_path): cmd = cmd + "mkdir " + log_path + "; " cmd = cmd + "chmod -R 755 " + log_path + "; " analysis_path = main_utils.get_mobileinsight_analysis_path() if not os.path.exists(analysis_path): cmd = cmd + "mkdir " + analysis_path + "; " cmd = cmd + "chmod -R 755 " + analysis_path + "; " cfg_path = main_utils.get_mobileinsight_cfg_path() if not os.path.exists(analysis_path): cmd = cmd + "mkdir " + cfg_path + "; " cmd = cmd + "chmod -R 755 " + cfg_path + "; " db_path = main_utils.get_mobileinsight_db_path() if not os.path.exists(db_path): cmd = cmd + "mkdir " + db_path + "; " cmd = cmd + "chmod -R 755 " + db_path + "; " plugin_path = main_utils.get_mobileinsight_plugin_path() if not os.path.exists(plugin_path): cmd = cmd + "mkdir " + plugin_path + "; " cmd = cmd + "chmod -R 755 " + plugin_path + "; " log_decoded_path = main_utils.get_mobileinsight_log_decoded_path() if not os.path.exists(log_decoded_path): cmd = cmd + "mkdir " + log_decoded_path + "; " cmd = cmd + "chmod -R 755 " + log_decoded_path + "; " log_uploaded_path = main_utils.get_mobileinsight_log_uploaded_path() if not os.path.exists(log_uploaded_path): cmd = cmd + "mkdir " + log_uploaded_path + "; " cmd = cmd + "chmod -R 755 " + log_uploaded_path + "; " crash_log_path = main_utils.get_mobileinsight_crash_log_path() if not os.path.exists(crash_log_path): cmd = cmd + "mkdir " + crash_log_path + "; " cmd = cmd + "chmod -R 755 " + crash_log_path + "; " # cmd = cmd + "chmod -R 755 "+mobileinsight_path+"; " main_utils.run_shell_cmd(cmd) return True