Skip to content

Commit 833b026

Browse files
committed
ref
1 parent f739d00 commit 833b026

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

sentry-android-core/src/main/java/io/sentry/android/core/SystemEventsBreadcrumbsIntegration.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -387,14 +387,14 @@ public void onReceive(final Context context, final @NotNull Intent intent) {
387387
final @Nullable String action = intent.getAction();
388388
final boolean isBatteryChanged = ACTION_BATTERY_CHANGED.equals(action);
389389

390-
// aligning with iOS which only captures battery status changes every minute at maximum
391-
if (isBatteryChanged && batteryChangedDebouncer.checkForDebounce()) {
392-
return;
393-
}
394-
395-
// For battery changes, check if the actual values have changed
396390
@Nullable BatteryState batteryState = null;
397391
if (isBatteryChanged) {
392+
if (batteryChangedDebouncer.checkForDebounce()) {
393+
// aligning with iOS which only captures battery status changes every minute at maximum
394+
return;
395+
}
396+
397+
// For battery changes, check if the actual values have changed
398398
final @Nullable Float currentBatteryLevel = DeviceInfoUtil.getBatteryLevel(intent, options);
399399
final @Nullable Boolean currentChargingState = DeviceInfoUtil.isCharging(intent, options);
400400
batteryState = new BatteryState(currentBatteryLevel, currentChargingState);

0 commit comments

Comments
 (0)