Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file removed Android/lib/arm64-v8a/libbacktrace-crashpad.so
Binary file not shown.
Binary file added Android/lib/arm64-v8a/libbacktrace-native.so
Binary file not shown.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file removed Android/lib/armeabi-v7a/libbacktrace-crashpad.so
Binary file not shown.
Binary file added Android/lib/armeabi-v7a/libbacktrace-native.so
Binary file not shown.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file removed Android/lib/x86/libbacktrace-crashpad.so
Binary file not shown.
Binary file added Android/lib/x86/libbacktrace-native.so
Binary file not shown.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Backtrace Unity Release Notes

## Version 3.2.0
- Updated Android NDK libraries used by Unity plugin.

## Version 3.1.2
- `BacktraceData` allows to edit list of environment variables collected by `BacktraceAnnotations`
- `SourceCode` object description for PII purpose
Expand Down
27 changes: 17 additions & 10 deletions Runtime/Native/Android/NativeClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ namespace Backtrace.Unity.Runtime.Native.Android
/// </summary>
internal class NativeClient : INativeClient
{
[DllImport("backtrace-crashpad")]
private static extern bool InitializeCrashpad(IntPtr submissionUrl, IntPtr databasePath, IntPtr handlerPath, IntPtr keys, IntPtr values);
[DllImport("backtrace-native")]
private static extern bool Initialize(IntPtr submissionUrl, IntPtr databasePath, IntPtr handlerPath, IntPtr keys, IntPtr values);

[DllImport("backtrace-crashpad")]
private static extern bool AddCrashpadAttribute(IntPtr key, IntPtr value);
[DllImport("backtrace-native")]
private static extern bool AddAttribute(IntPtr key, IntPtr value);

private readonly BacktraceConfiguration _configuration;
// Android native interface paths
Expand All @@ -29,15 +29,20 @@ internal class NativeClient : INativeClient
/// <summary>
/// Determine if android integration should be enabled
/// </summary>
private bool _enabled = Application.platform == RuntimePlatform.Android;
private bool _enabled =
#if UNITY_ANDROID && !UNITY_EDITOR
true;
#else
false;
#endif

/// <summary>
/// Anr watcher object
/// </summary>
private AndroidJavaObject _anrWatcher;

private bool _captureNativeCrashes = false;
private bool _handlerANR = false;
private readonly bool _handlerANR = false;
public NativeClient(string gameObjectName, BacktraceConfiguration configuration)
{
_configuration = configuration;
Expand All @@ -48,10 +53,9 @@ public NativeClient(string gameObjectName, BacktraceConfiguration configuration)
#if UNITY_ANDROID
_captureNativeCrashes = _configuration.CaptureNativeCrashes;
_handlerANR = _configuration.HandleANR;
#endif
HandleAnr(gameObjectName, "OnAnrDetected");
HandleNativeCrashes();

#endif

}
/// <summary>
Expand Down Expand Up @@ -87,12 +91,15 @@ private void HandleNativeCrashes()
}
// get default built-in Backtrace-Unity attributes
var backtraceAttributes = new BacktraceAttributes(null, null, true);
// add exception type to crashes handled by crashpad - all exception handled by crashpad
// will be game crashes
backtraceAttributes.Attributes["exception.type"] = "Crash";
var minidumpUrl = new BacktraceCredentials(_configuration.GetValidServerUrl()).GetMinidumpSubmissionUrl().ToString();

// reassign to captureNativeCrashes
// to avoid doing anything on crashpad binary, when crashpad
// isn't available
_captureNativeCrashes = InitializeCrashpad(
_captureNativeCrashes = Initialize(
AndroidJNI.NewStringUTF(minidumpUrl),
AndroidJNI.NewStringUTF(_configuration.CrashpadDatabasePath),
AndroidJNI.NewStringUTF(crashpadHandlerPath),
Expand Down Expand Up @@ -179,7 +186,7 @@ public void SetAttribute(string key, string value)
value = string.Empty;
}

AddCrashpadAttribute(
AddAttribute(
AndroidJNI.NewStringUTF(key),
AndroidJNI.NewStringUTF(value));
}
Expand Down
2 changes: 1 addition & 1 deletion Runtime/Services/BacktraceApi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ public IEnumerator SendMinidump(string minidumpPath, IEnumerable<string> attachm

foreach (var file in attachments)
{
if (File.Exists(file) && new FileInfo(file).Length > 10000000)
if (File.Exists(file) && new FileInfo(file).Length < 10000000)
{
formData.Add(new MultipartFormFileSection(
string.Format("attachment__{0}", Path.GetFileName(file)),
Expand Down