-
Notifications
You must be signed in to change notification settings - Fork 608
[Fireperf][Fixit] Change AppStartTrace
from singleton to normal object
#4186
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’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Generated by 🚫 Danger |
Coverage Report 1Affected Products
Test Logs |
Size Report 1Affected Products
Test Logs |
} | ||
} | ||
return instance; | ||
public AppStartTrace() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure if "De-singletoning this hides AppStartTrace.getInstance() from customers. " Customers can still call new AppStartTrace() I think.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are there any changes to the unit tests that need to accompany this change? We seem to be changing the way we allow to create/access AppStartTrace.
Description
b/251844673
De-singleton
AppStartTrace
. This is the lowest hanging fruit since it only has one single dependee.Side effect / additional benefit
De-singletoning this hides
AppStartTrace.getInstance()
from customers. That is an undocumented and unsupported API, and customers can technically mess with it and call methods they are not supposed to call. This PR makes it impossible for customers to call its method and break app-start trace in unexpected ways.Analysis: Object Lifetime (is it safe to de-singleton
AppStartTrace
?)TLDR: yes, because Android platform's

Application
will hold a reference to AppStartTrace until the trace completes.