Skip to content

Commit

Permalink
Merge 9e0e708 into 9f69368
Browse files Browse the repository at this point in the history
  • Loading branch information
fractalwrench committed Jan 9, 2019
2 parents 9f69368 + 9e0e708 commit 2ddbc06
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 10 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
@@ -1,5 +1,12 @@
# Changelog

## 4.X.X (TBD)

### Bug fixes

* Prevent unnecessary free disk calculations on initialisation
[#409](https://github.com/bugsnag/bugsnag-android/pull/409)

## 4.10.0 (2019-01-07)

* Improve kotlin support by allowing property access
Expand Down
23 changes: 14 additions & 9 deletions ndk/src/main/java/com/bugsnag/android/ndk/NativeBridge.java
Expand Up @@ -217,21 +217,26 @@ private void handleInstallMessage(Object arg) {
return;
}
String reportPath = reportDirectory + UUID.randomUUID().toString() + ".crash";
String[] abis = (String[])NativeInterface.getDeviceData().get("cpuAbi");
boolean is32bit = true;
for (String abi : abis) {
if (abi.contains("64")) {
is32bit = false;
break;
}
}
install(reportPath, true, Build.VERSION.SDK_INT, is32bit);
install(reportPath, true, Build.VERSION.SDK_INT, is32bit());
installed.set(true);
} finally {
lock.unlock();
}
}

private boolean is32bit() {
String[] abis = NativeInterface.getCpuAbi();

boolean is32bit = true;
for (String abi : abis) {
if (abi.contains("64")) {
is32bit = false;
break;
}
}
return is32bit;
}

private void handleAddBreadcrumb(Object arg) {
if (arg instanceof Breadcrumb) {
Breadcrumb crumb = (Breadcrumb) arg;
Expand Down
2 changes: 1 addition & 1 deletion sdk/src/main/java/com/bugsnag/android/Client.java
Expand Up @@ -146,7 +146,7 @@ public Client(@NonNull Context androidContext, @NonNull Configuration configurat
// Set sensible defaults
setProjectPackages(appContext.getPackageName());

String deviceId = getStringFromMap("id", deviceData.getDeviceData());
String deviceId = deviceData.getId();

if (config.getPersistUserBetweenSessions()) {
// Check to see if a user was stored in the SharedPreferences
Expand Down
4 changes: 4 additions & 0 deletions sdk/src/main/java/com/bugsnag/android/DeviceData.java
Expand Up @@ -127,6 +127,10 @@ Map<String, Object> getDeviceMetaData() {
return map;
}

String getId() {
return id;
}

/**
* Check if the current Android device is rooted
*/
Expand Down
9 changes: 9 additions & 0 deletions sdk/src/main/java/com/bugsnag/android/NativeInterface.java
Expand Up @@ -16,6 +16,7 @@
* Used as the entry point for native code to allow proguard to obfuscate other areas if needed
*/
public class NativeInterface {

public enum MessageType {
/**
* Add a breadcrumb. The Message object should be the breadcrumb
Expand Down Expand Up @@ -233,6 +234,14 @@ public static Map<String,Object> getDeviceData() {
return deviceData;
}

/**
* Retrieve the CPU ABI(s) for the current device
*/
@NonNull
public static String[] getCpuAbi() {
return getClient().deviceData.cpuAbi;
}

/**
* Retrieves global metadata from the static Client instance as a Map
*/
Expand Down

0 comments on commit 2ddbc06

Please sign in to comment.