Commit db80683e authored by Mohamed Heikal's avatar Mohamed Heikal Committed by Commit Bot

[Android] Fix crash if ChromeTabbedActivity finishes early

A crash happens in ActivityTabStartupMetricsTracker if the tracked
ChromeActivity calls finish() but its onDestroy lifecycle method is not
called before chrome finishes its startup.
This cl adds a check to see if the ChromeActivity is finishing before
adding observers for metrics tracking.

Bug: 847580
Change-Id: I1a6685c770286c0533960c4ff7032dc047042c96
Reviewed-on: https://chromium-review.googlesource.com/1079202
Commit-Queue: Mohamed Heikal <mheikal@chromium.org>
Reviewed-by: default avatarMaria Khomenko <mariakhomenko@chromium.org>
Cr-Commit-Position: refs/heads/master@{#562925}
parent e54ff847
......@@ -40,6 +40,10 @@ public class ActivityTabStartupMetricsTracker {
.addStartupCompletedObserver(new BrowserStartupController.StartupCallback() {
@Override
public void onSuccess() {
// Activity could have called finish and returned early during startup but
// not have onDestroy called yet. The activity's TabModelSelector may not
// have been initialized causing a crash. See https://crbug.com/847580
if (mActivity.isActivityFinishing()) return;
registerObservers();
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment