Skip to content
Merged
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
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@
- Reduce excessive CPU usage when serializing breadcrumbs to disk for ANRs ([#4181](https://github.com/getsentry/sentry-java/pull/4181))
- Ensure app start type is set, even when ActivityLifecycleIntegration is not running ([#4250](https://github.com/getsentry/sentry-java/pull/4250))

### Behavioral Changes

- The user's `device.name` is not reported anymore via the device context, even if `options.isSendDefaultPii` is enabled ([#4179](https://github.com/getsentry/sentry-java/pull/4179))

### Dependencies

- Bump Gradle from v8.12.1 to v8.13.0 ([#4209](https://github.com/getsentry/sentry-java/pull/4209))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -639,9 +639,6 @@ private void setDevice(final @NotNull SentryBaseEvent event) {
@SuppressLint("NewApi")
private @NotNull Device getDevice() {
Device device = new Device();
if (options.isSendDefaultPii()) {
device.setName(ContextUtils.getDeviceName(context));
}
device.setManufacturer(Build.MANUFACTURER);
device.setBrand(Build.BRAND);
device.setFamily(ContextUtils.getFamily(options.getLogger()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.os.Build;
import android.provider.Settings;
import android.util.DisplayMetrics;
import io.sentry.ILogger;
import io.sentry.SentryLevel;
Expand Down Expand Up @@ -90,10 +89,6 @@ private ContextUtils() {}
// to avoid doing a bunch of Binder calls we use LazyEvaluator to cache the values that are static
// during the app process running

private static final @NotNull AndroidLazyEvaluator<String> deviceName =
new AndroidLazyEvaluator<>(
(context) -> Settings.Global.getString(context.getContentResolver(), "device_name"));

private static final @NotNull LazyEvaluator<Boolean> isForegroundImportance =
new LazyEvaluator<>(
() -> {
Expand Down Expand Up @@ -403,10 +398,6 @@ public static boolean isForegroundImportance() {
}
}

static @Nullable String getDeviceName(final @NotNull Context context) {
return deviceName.getValue(context);
}

static @NotNull String[] getArchitectures() {
return Build.SUPPORTED_ABIS;
}
Expand Down Expand Up @@ -521,7 +512,6 @@ public static Context getApplicationContext(final @NotNull Context context) {

@TestOnly
static void resetInstance() {
deviceName.resetValue();
isForegroundImportance.resetValue();
staticPackageInfo33.resetValue();
staticPackageInfo.resetValue();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,6 @@ public Device collectDeviceInformation(
final boolean collectDeviceIO, final boolean collectDynamicData) {
// TODO: missing usable memory
final @NotNull Device device = new Device();

if (options.isSendDefaultPii()) {
device.setName(ContextUtils.getDeviceName(context));
}
device.setManufacturer(Build.MANUFACTURER);
device.setBrand(Build.BRAND);
device.setFamily(ContextUtils.getFamily(options.getLogger()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package io.sentry.android.core
import android.content.Context
import android.content.Intent
import android.os.BatteryManager
import android.provider.Settings
import androidx.test.core.app.ApplicationProvider
import androidx.test.ext.junit.runners.AndroidJUnit4
import io.sentry.android.core.internal.util.CpuInfoUtils
Expand All @@ -29,7 +28,6 @@ class DeviceInfoUtilTest {
75
).putExtra(BatteryManager.EXTRA_PLUGGED, 0)
)
Settings.Global.putString(context.contentResolver, "device_name", "sentry")
DeviceInfoUtil.resetInstance()
}

Expand All @@ -51,30 +49,6 @@ class DeviceInfoUtilTest {
assertNotNull(deviceInfo.memorySize)
}

@Test
fun `does not include device name when PII is disabled`() {
val deviceInfoUtil = DeviceInfoUtil.getInstance(
context,
SentryAndroidOptions().apply {
isSendDefaultPii = false
}
)
val deviceInfo = deviceInfoUtil.collectDeviceInformation(false, false)
assertNull(deviceInfo.name)
}

@Test
fun `does include device name when pii is enabled`() {
val deviceInfoUtil = DeviceInfoUtil.getInstance(
context,
SentryAndroidOptions().apply {
isSendDefaultPii = true
}
)
val deviceInfo = deviceInfoUtil.collectDeviceInformation(false, false)
assertNotNull(deviceInfo.name)
}

@Test
fun `does include cpu data`() {
CpuInfoUtils.getInstance().setCpuMaxFrequencies(listOf(1024))
Expand Down
Loading