Skip to content

Commit

Permalink
Fix: Make App start cold/warm visible to Hybrid SDKs (#1848)
Browse files Browse the repository at this point in the history
  • Loading branch information
marandaneto committed Dec 16, 2021
1 parent 78459e1 commit c8578f7
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Expand Up @@ -3,6 +3,7 @@
## Unreleased

* Bump: log4j to 2.16.0 (#1845)
* Fix: Make App start cold/warm visible to Hybrid SDKs (#1848)

## 5.5.0

Expand Down
1 change: 1 addition & 0 deletions sentry-android-core/api/sentry-android-core.api
Expand Up @@ -34,6 +34,7 @@ public final class io/sentry/android/core/AppLifecycleIntegration : io/sentry/In
}

public final class io/sentry/android/core/AppStartState {
public fun getAppStartInterval ()Ljava/lang/Long;
public fun getAppStartTime ()Ljava/util/Date;
public static fun getInstance ()Lio/sentry/android/core/AppStartState;
public fun isColdStart ()Z
Expand Down
Expand Up @@ -260,7 +260,7 @@ public synchronized void onActivityStarted(final @NonNull Activity activity) {

@Override
public synchronized void onActivityResumed(final @NonNull Activity activity) {
if (!firstActivityResumed && performanceEnabled) {
if (!firstActivityResumed) {

// we only finish the app start if the process is of foregroundImportance
if (foregroundImportance) {
Expand All @@ -277,7 +277,7 @@ public synchronized void onActivityResumed(final @NonNull Activity activity) {
}

// finishes app start span
if (appStartSpan != null) {
if (performanceEnabled && appStartSpan != null) {
appStartSpan.finish();
}
firstActivityResumed = true;
Expand Down Expand Up @@ -355,7 +355,7 @@ ISpan getAppStartSpan() {
}

private void setColdStart(final @Nullable Bundle savedInstanceState) {
if (!firstActivityCreated && performanceEnabled) {
if (!firstActivityCreated) {
// if Activity has savedInstanceState then its a warm start
// https://developer.android.com/topic/performance/vitals/launch-time#warm
AppStartState.getInstance().setColdStart(savedInstanceState == null);
Expand Down
Expand Up @@ -44,7 +44,7 @@ void setAppStartEnd(final long appStartEndMillis) {
}

@Nullable
synchronized Long getAppStartInterval() {
public synchronized Long getAppStartInterval() {
if (appStartMillis == null || appStartEndMillis == null) {
return null;
}
Expand Down

0 comments on commit c8578f7

Please sign in to comment.