正在查看: imToken v3.28.8 应用的 DefaultErrorScreen.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: imToken v3.28.8 应用的 DefaultErrorScreen.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package com.masteratul.exceptionhandler;
import android.app.Activity;
import android.app.AlarmManager;
import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import com.sensorsdata.analytics.android.sdk.SensorsDataAutoTrackHelper;
public class DefaultErrorScreen extends Activity {
private static String TAG = "RN_ERROR_HANDLER";
private Button quitButton;
private Button relaunchButton;
private Button showDetailsButton;
private TextView stackTraceView;
@Override
protected void onCreate(Bundle bundle) {
String str;
super.onCreate(bundle);
try {
str = getIntent().getExtras().getString("stack_trace_string");
} catch (Exception e) {
Log.e(TAG, String.format("Was not able to get StackTrace: %s", e.getMessage()));
str = "StackTrace unavailable";
}
setContentView(R.layout.default_error_screen);
this.quitButton = (Button) findViewById(R.id.eh_quit_button);
this.relaunchButton = (Button) findViewById(R.id.eh_restart_button);
this.showDetailsButton = (Button) findViewById(R.id.eh_show_details_button);
TextView textView = (TextView) findViewById(R.id.eh_stack_trace_text_view);
this.stackTraceView = textView;
textView.setText(str);
this.showDetailsButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (DefaultErrorScreen.this.stackTraceView.getVisibility() == 0) {
DefaultErrorScreen.this.stackTraceView.setVisibility(8);
DefaultErrorScreen.this.showDetailsButton.setText("SHOW DETAILS");
} else {
DefaultErrorScreen.this.stackTraceView.setVisibility(0);
DefaultErrorScreen.this.showDetailsButton.setText("HIDE DETAILS");
}
SensorsDataAutoTrackHelper.trackViewOnClick(view);
}
});
this.relaunchButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
DefaultErrorScreen.doRestart(DefaultErrorScreen.this.getApplicationContext());
SensorsDataAutoTrackHelper.trackViewOnClick(view);
}
});
this.quitButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
System.exit(0);
SensorsDataAutoTrackHelper.trackViewOnClick(view);
}
});
}
public static void doRestart(Context context) {
try {
if (context != null) {
PackageManager packageManager = context.getPackageManager();
if (packageManager != null) {
Intent launchIntentForPackage = packageManager.getLaunchIntentForPackage(context.getPackageName());
if (launchIntentForPackage != null) {
launchIntentForPackage.addFlags(67108864);
((AlarmManager) context.getSystemService("alarm")).set(1, System.currentTimeMillis() + 100, PendingIntent.getActivity(context, 654311, launchIntentForPackage, 268435456));
System.exit(0);
return;
}
throw new Exception("Was not able to restart application, mStartActivity null");
}
throw new Exception("Was not able to restart application, PM null");
}
throw new Exception("Was not able to restart application, Context null");
} catch (Exception unused) {
Log.e(TAG, "Was not able to restart application");
}
}
}