Fix Chrome Android Crash: Resolving the flags_state.cc Error (cr136 Patch)
Experiencing crashes in your Chrome Android app? This article breaks down a critical Chromium patch (cr136) addressing a tricky bug related to feature flags. Learn what caused this crash and how the patch resolves it.
The Chrome Android Crash: A Feature Flag Problem
The bug arises when a feature flag enabled in a previous Chrome version (cr135) is removed in a subsequent version (cr136). This inconsistency leads to a crash within the Android app. One user reported this specific crash in the Google Play console.
Diving into the Stack Trace: Understanding the Crash Location
The stack trace provided points to the flags_state.cc
file as the source of the crash. Let's examine the key function calls:
base::ImmediateCrash()
: Indicates an immediate program termination due to a critical error.logging::CheckFailure()
: Signals a failed integrity check.flags_ui::FlagsState::SetFlags()
: This is where the crash occurs, specifically at line 1189 offlags_state.cc
. This function attempts to set flags, but fails when encountering an unexpected state related to enabled/disabled feature flags.
This function is part of a sequence that does the following:
flags_ui::FlagsState::GetSanitizedEnabledFlags()
flags_ui::FlagsState::GetSanitizedEnabledFlagsForCurrentPlatform()
flags_ui::FlagsState::GenerateFlagsToSwitchesMapping()
flags_ui::FlagsState::ConvertFlagsToSwitches()
Finally, the crash originates during Chrome's startup sequence:
ChromeFeatureListCreator::ConvertFlagsToSwitches()
ChromeFeatureListCreator::CreateFeatureList()
ChromeMainDelegate::PostEarlyInitialization()
BraveMainDelegate::PostEarlyInitialization()
content::ContentMainRunnerImpl::RunBrowser()
content::ContentMainRunnerImpl::Run()
Why Does This Crash Happen?
The crash happens due to an inconsistency in how Chrome handles feature flags. When an older version enables a flag, and a newer version removes the said flag, Chrome will attempt to use this flag, which no longer exists. The system throws errors, resulting in the crash.
The cr136 Patch: The Solution
The cr136 patch addresses this issue by implementing more robust validation and handling of feature flag states during Chrome's startup. Essentially, it prevents the application from crashing when encountering a removed/invalid flag.
Impact of the Patch
By applying the cr136 patch, Chrome will:
- Prevent crashes: Eliminates the crash caused by inconsistent feature flag states during startup.
- Improve Stability: Enhance the overall stability and reliability of the Chrome Android app.
- Reduce user frustration: Provides a smoother, user-friendly experience.
How to Get the Fix
The cr136 patch is incorporated into newer versions of Chrome. Users should update to the latest version of Chrome on their Android devices to benefit from this fix. Consider these steps to update:
- Google Play Store: Open the Google Play Store app.
- Manage Apps & Devices: Tap your profile icon, then select "Manage apps & device".
- Update Chrome: If an update is available for Chrome, tap "Update".
Conclusion
The cr136 patch is a crucial fix for a specific crash affecting the Chrome Android app. Updating to the latest Chrome version ensures that you have this patch and other important stability improvements, which provides a much better browsing experience.