正在查看: Jurassic World v1.83.4 应用的 HSDebugActivity.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: Jurassic World v1.83.4 应用的 HSDebugActivity.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package com.helpshift.activities;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.widget.TextView;
import androidx.appcompat.app.AppCompatActivity;
import com.helpshift.R;
import com.helpshift.log.LogCollector;
import com.helpshift.storage.HSPersistentStorage;
import com.helpshift.storage.SharedPreferencesStore;
import com.helpshift.util.Utils;
import com.microsoft.appcenter.crashes.ingestion.models.ErrorAttachmentLog;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.util.Arrays;
public class HSDebugActivity extends AppCompatActivity {
private static final String TAG = "Helpshift_DebugAct";
protected void onCreate(Bundle bundle) {
super.onCreate(bundle);
setContentView(R.layout.hs__debug_layout);
}
protected void onResume() {
super.onResume();
TextView textView = (TextView) findViewById(R.id.debug_log_message);
textView.setText("Preparing logs...");
BufferedReader bufferedReader = null;
try {
try {
int i = 0;
HSPersistentStorage hSPersistentStorage = new HSPersistentStorage(new SharedPreferencesStore(this, HSPersistentStorage.FILE_NAME, 0));
String str = hSPersistentStorage.getDomain() + "." + hSPersistentStorage.getHost();
String appName = getAppName();
File file = new File(getFilesDir() + File.separator + LogCollector.logDirPath);
StringBuilder sb = new StringBuilder();
File[] listFiles = file.listFiles();
if (file.exists() && listFiles != null && listFiles.length > 0) {
Arrays.sort(listFiles);
int length = listFiles.length;
while (i < length) {
File file2 = listFiles[i];
sb.append("Log File: ").append(file2.getName()).append("\n \n");
BufferedReader bufferedReader2 = new BufferedReader(new FileReader(file2));
while (true) {
try {
String readLine = bufferedReader2.readLine();
if (readLine == null) {
break;
} else {
sb.append(readLine).append("\n");
}
} catch (Exception e) {
e = e;
bufferedReader = bufferedReader2;
Log.e(TAG, "Error when sharing/reading log", e);
textView.setText("Error preparing logs: " + e.getMessage());
Utils.closeQuietly(bufferedReader);
} catch (Throwable th) {
th = th;
bufferedReader = bufferedReader2;
Utils.closeQuietly(bufferedReader);
throw th;
}
}
sb.append("\n \n");
i++;
bufferedReader = bufferedReader2;
}
}
Intent intent = new Intent("android.intent.action.SEND");
intent.setType(ErrorAttachmentLog.CONTENT_TYPE_TEXT_PLAIN);
intent.putExtra("android.intent.extra.EMAIL", new String[]{"[email protected]"});
intent.putExtra("android.intent.extra.TEXT", sb.toString());
intent.putExtra("android.intent.extra.SUBJECT", str + " / " + appName + " / " + getPackageName());
startActivity(Intent.createChooser(intent, "Send email..."));
finish();
} catch (Exception e2) {
e = e2;
}
Utils.closeQuietly(bufferedReader);
} catch (Throwable th2) {
th = th2;
}
}
private String getAppName() {
try {
return getApplicationInfo().loadLabel(getPackageManager()).toString();
} catch (Exception unused) {
return "";
}
}
}