正在查看: 管控平台 v5.2.3.0. 应用的 AndroidSentryClientFactory.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: 管控平台 v5.2.3.0. 应用的 AndroidSentryClientFactory.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package io.sentry.android;
import android.content.Context;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.util.Log;
import b.a.a;
import b.a.c;
import b.a.g.b;
import io.sentry.android.event.helper.AndroidEventBuilderHelper;
import java.io.File;
import java.util.ArrayList;
import java.util.Collection;
public class AndroidSentryClientFactory extends a {
public static final String i = "io.sentry.android.AndroidSentryClientFactory";
private Context h;
public AndroidSentryClientFactory(Context context) {
Log.d(i, "Construction of Android Sentry.");
this.h = context.getApplicationContext();
}
private boolean R(String str) {
return this.h.checkCallingOrSelfPermission(str) == 0;
}
@Override
protected Collection<String> D(io.sentry.dsn.a aVar) {
Collection<String> D = super.D(aVar);
if (!D.isEmpty()) {
return D;
}
PackageInfo packageInfo = null;
try {
packageInfo = this.h.getPackageManager().getPackageInfo(this.h.getPackageName(), 0);
} catch (PackageManager.NameNotFoundException e) {
Log.e(i, "Error getting package information.", e);
}
if (packageInfo == null || io.sentry.util.a.a(packageInfo.packageName)) {
return D;
}
ArrayList arrayList = new ArrayList(1);
arrayList.add(packageInfo.packageName);
return arrayList;
}
@Override
public c a(io.sentry.dsn.a aVar) {
if (!R("android.permission.INTERNET")) {
Log.e(i, "android.permission.INTERNET is required to connect to the Sentry server, please add it to your AndroidManifest.xml");
}
Log.d(i, "Sentry init with ctx='" + this.h.toString() + "' and dsn='" + aVar + "'");
String i2 = aVar.i();
if (i2.equalsIgnoreCase("noop")) {
Log.w(i, "*** Couldn't find a suitable DSN, Sentry operations will do nothing! See documentation: https://docs.sentry.io/clients/java/modules/android/ ***");
} else if (!i2.equalsIgnoreCase("http") && !i2.equalsIgnoreCase("https")) {
String d = b.d("async", aVar);
if (d != null && d.equalsIgnoreCase("false")) {
throw new IllegalArgumentException("Sentry Android cannot use synchronous connections, remove 'async=false' from your options.");
}
throw new IllegalArgumentException("Only 'http' or 'https' connections are supported in Sentry Android, but received: " + i2);
}
c a2 = super.a(aVar);
a2.a(new AndroidEventBuilderHelper(this.h));
return a2;
}
@Override
protected b.a.f.a q(io.sentry.dsn.a aVar) {
String d = b.d("buffer.dir", aVar);
File file = d != null ? new File(d) : new File(this.h.getCacheDir().getAbsolutePath(), "sentry-buffered-events");
Log.d(i, "Using buffer dir: " + file.getAbsolutePath());
return new b.a.f.b(file, t(aVar));
}
@Override
protected io.sentry.context.a y(io.sentry.dsn.a aVar) {
return new io.sentry.context.b();
}
}