-
-
Notifications
You must be signed in to change notification settings - Fork 448
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
ActivityFrameTracker breaks runtime theme changing. #1659
Comments
@lennykano thanks for reporting, interesting corner case, let me investigate this, if its the case, we can move the calls from |
@marandaneto thanks for the quick turnaround. |
Add error message for database crash and enable Sentry. Pin sentry 4.3.0 due to getsentry/sentry-java#1659 being not resolved.
This still seems to be an issue, on Sentry 5.0.1 calling setTheme on the activity works correctly but doesn't when using Sentry 5.2.3. I've attached a sample project showing the issue, the windowBackground of the activity is set to red as defined in theme but Sentry 5.2.3 prevents the theme from being applied. If you uncomment the gradle configuration to switch back to Sentry 5.0.1 then the red activity windowBackground is applied correctly as expected. |
Just to confirm, Sentry 5.2.4 fixed my issue, thanks! 🎉 |
Platform:
IDE:
Build system:
Android Gradle Plugin:
Sentry Android Gradle Plugin:
Proguard/R8:
Platform installed with:
Using this repository so all dependency/build versions are as specified in the sample code available.
Tested using Android Studio 2021.1.1 (not a build related issue, read below for cause)
Problem occurs on all Android versions >= 29
The version of the SDK:
5.1.0-beta6+
I have the following issue:
Setting an activity theme at runtime is broken since 5.1.0-beta6 (problem remains on 5.1.0) ...
Steps to reproduce:
setTheme(R.style.Theme_AppCompat);
beforesuper.onCreate(savedInstanceState);
in the sample appsMainActivity
.Expected result:
Actual result:
If I remove usages of
ActivityFramesTracker
then it behaves as suspected and window background is applied correctly. Can also hardcodeisAllActivityCallbacksAvailable
to false so the frame tracker applies later, in onCreate, and the issue won't present itself.My suspicion is that
frameMetricsAggregator.add(activity);
is being called too early (currently inonActivityPreCreated
lifecycle callback), and is causing WindowManager to 'lock in' the window background, preventing it from changing when the theme is updated later on. Notice that other theme attributes (action bar, text color) are applied successfully.This makes the SDK unusable as the splash screen background is persisting after the activity has finished loading. Not sure why you need to run anything in
onActivityPreCreate
but if that can be avoided, would be the simplest solution to the problem.The text was updated successfully, but these errors were encountered: