Skip to content

Conversation

@tcmulcahy
Copy link
Contributor

No description provided.

@tcmulcahy tcmulcahy force-pushed the tomm/deprecate-apis branch from 69392b7 to e0e00fc Compare October 27, 2025 19:00
androidx.tracing.Trace.beginSection(label.take(MAX_LABEL_LENGTH))
}

@Deprecated("Call androidx.tracing.Trace.beginSection instead", ReplaceWith("beginSection", "androidx.tracing.Trace.beginSection"))
Copy link
Contributor Author

@tcmulcahy tcmulcahy Oct 27, 2025

Choose a reason for hiding this comment

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

androidx.tracing.Trace.beginSection doesn't support a lambda, but we could provide an extension function for that.

/**
* @see [logSection]
*/
@Deprecated("Call androidx.tracing.Trace.beginSection/endSection instead")
Copy link
Contributor Author

Choose a reason for hiding this comment

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

logSection doesn't exist in Jetpack, but we could provide an extension function androidx.tracing.Trace.logSection to do this.

/**
* @see androidx.tracing.Trace.beginAsyncSection
*/
@Deprecated("Call androidx.tracing.Trace.beginAsyncSection instead", ReplaceWith("beginAsyncSection", "androidx.tracing.Trace.beginAsyncSection"))
Copy link
Contributor Author

Choose a reason for hiding this comment

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

androidx.tracing.Trace.beginAsyncSection doesn't support passing a lambda, but we could provide an extension function for that.

enableMainThreadMessageTracing()
}

fun enableMainThreadMessageTracing() {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Since we're deprecating forceEnableAppTracing, we need to expose a way for callers to invoke enableMainThreadMessageTracing directly.

@tcmulcahy tcmulcahy force-pushed the tomm/deprecate-apis branch from 7830ed7 to 5dd78bf Compare October 27, 2025 23:29
@tcmulcahy tcmulcahy force-pushed the tomm/deprecate-apis branch from 5dd78bf to f3ec685 Compare October 27, 2025 23:55
@tcmulcahy tcmulcahy force-pushed the tomm/deprecate-apis branch 3 times, most recently from 1125edb to a81398e Compare October 28, 2025 03:21
@tcmulcahy tcmulcahy force-pushed the tomm/deprecate-apis branch from a81398e to 21b7a35 Compare October 28, 2025 03:55
<manifest xmlns:android="http://schemas.android.com/apk/res/android">

<application>
<!-- A receiver that makes the build shell profileable on broadcast, disabled by default. -->
Copy link
Contributor Author

Choose a reason for hiding this comment

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

These are unused.

val isCurrentlyTracing: Boolean
get() = androidx.tracing.Trace.isEnabled()

@Deprecated("Use forceShellProfileable instead", ReplaceWith("forceShellProfileable()"))
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This was unused. Rather than keep a deprecated version of it, I think it makes more sense to remove it entirely.

@tcmulcahy tcmulcahy marked this pull request as ready for review October 28, 2025 04:43
@tcmulcahy tcmulcahy requested a review from pyricau as a code owner October 28, 2025 04:43
fun init(application: Application) {
this.application = application
enableMainThreadMessageTracing()
}
Copy link
Member

Choose a reason for hiding this comment

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

Do we still need the application field here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I need it until I remove all callers of SafeTrace.isTraceable. Then I'll remove it.

}

fun enableMainThreadMessageTracing() {
SafeTraceMainThreadMessages.enableMainThreadMessageTracing()
Copy link
Member

Choose a reason for hiding this comment

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

we probably ought to make a public API for this, but ideally something cohesive not a random function of a SafeTrace object that's not about safe traces anymore

Copy link
Contributor Author

Choose a reason for hiding this comment

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

How about I move SafeTraceMainThreadMessages out of the internal package and make it public?

"PAPA-cancel:timeout"
}
Trace.beginSection("PAPA-cancel:timeout")
Trace.endSection()
Copy link
Member

Choose a reason for hiding this comment

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

why not use the lambda version with {} ?

or at least bring back logSection as helper function here?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants