Skip to content

Commit

Permalink
Format code
Browse files Browse the repository at this point in the history
  • Loading branch information
getsentry-bot committed Nov 16, 2022
1 parent 2e19e51 commit 42e606b
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,8 @@ private static void installDefaultIntegrations(
if (isFragmentAvailable) {
options.addIntegration(new FragmentLifecycleIntegration((Application) context, true, true));
}
options.addEventProcessor(new ScreenshotEventProcessor((Application) context, options, buildInfoProvider));
options.addEventProcessor(
new ScreenshotEventProcessor((Application) context, options, buildInfoProvider));
} else {
options
.getLogger()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,13 @@ public final class ScreenshotEventProcessor
private boolean lifecycleCallbackInstalled = true;

public ScreenshotEventProcessor(
final @NotNull Application application, final @NotNull SentryAndroidOptions options, final @NotNull BuildInfoProvider buildInfoProvider) {
final @NotNull Application application,
final @NotNull SentryAndroidOptions options,
final @NotNull BuildInfoProvider buildInfoProvider) {
this.application = Objects.requireNonNull(application, "Application is required");
this.options = Objects.requireNonNull(options, "SentryAndroidOptions is required");
this.buildInfoProvider = Objects.requireNonNull(buildInfoProvider, "BuildInfoProvider is required");
this.buildInfoProvider =
Objects.requireNonNull(buildInfoProvider, "BuildInfoProvider is required");

application.registerActivityLifecycleCallbacks(this);
}
Expand All @@ -60,12 +63,16 @@ public ScreenshotEventProcessor(

return event;
}
if (CurrentActivityHolder.getInstance().getActivity() == null || HintUtils.isFromHybridSdk(hint)) {
if (CurrentActivityHolder.getInstance().getActivity() == null
|| HintUtils.isFromHybridSdk(hint)) {
return event;
}

final byte[] screenshot =
takeScreenshot(CurrentActivityHolder.getInstance().getActivity(), options.getLogger(), buildInfoProvider);
takeScreenshot(
CurrentActivityHolder.getInstance().getActivity(),
options.getLogger(),
buildInfoProvider);
if (screenshot == null) {
return event;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,16 @@
import io.sentry.ILogger;
import io.sentry.SentryLevel;
import io.sentry.android.core.BuildInfoProvider;

import java.io.ByteArrayOutputStream;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;

@ApiStatus.Internal
public class ScreenshotUtils {
public static @Nullable byte[] takeScreenshot(
final @Nullable Activity activity, final @NotNull ILogger logger, final @NotNull BuildInfoProvider buildInfoProvider) {
final @Nullable Activity activity,
final @NotNull ILogger logger,
final @NotNull BuildInfoProvider buildInfoProvider) {
if (activity == null) {
return null;
}
Expand Down Expand Up @@ -63,7 +64,8 @@ public class ScreenshotUtils {
return null;
}

public static boolean isActivityValid(final @Nullable Activity activity, final @NotNull BuildInfoProvider buildInfoProvider) {
public static boolean isActivityValid(
final @Nullable Activity activity, final @NotNull BuildInfoProvider buildInfoProvider) {
if (activity == null) {
return false;
}
Expand Down

0 comments on commit 42e606b

Please sign in to comment.