Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Make App start cold/warm visible to Hybrid SDKs #1848

Merged
merged 2 commits into from Dec 16, 2021
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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() {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if (appStartMillis == null || appStartEndMillis == null) {
return null;
}
Expand Down