Commit f0a63ab9 authored by Mei Liang's avatar Mei Liang Committed by Commit Bot

Avoid TabGroupModelFilter casting exception(2)

This is a follow up of crrev.com/c/2442479. This CL early returns when
TabModelFilterProvider().getTabModelFilter() is not a
TabGroupModelFilter to avoid the casting exception in
TabGroupUiCoordinator.recordSessionCount().

This CL is gated by Finch parameter "enable_launch_polish" under flag
"enable-tab-grid-layout", with gate function
TabUiFeatureUtilities#isLaunchPolishEnabled.

Bug: 1133922
Change-Id: I830b6721e15b6ca558e79b66dcd7a1b783186f7d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2443395Reviewed-by: default avatarWei-Yin Chen (陳威尹) <wychen@chromium.org>
Commit-Queue: Mei Liang <meiliang@chromium.org>
Cr-Commit-Position: refs/heads/master@{#812903}
parent e862177f
...@@ -255,6 +255,23 @@ public class TabGroupUiCoordinator implements TabGroupUiMediator.ResetHandler, T ...@@ -255,6 +255,23 @@ public class TabGroupUiCoordinator implements TabGroupUiMediator.ResetHandler, T
} }
private void recordSessionCount() { private void recordSessionCount() {
if (TabUiFeatureUtilities.isLaunchPolishEnabled()) {
TabModelFilter normalTabModelFilter =
mActivity.getTabModelSelector().getTabModelFilterProvider().getTabModelFilter(
false);
if (!(normalTabModelFilter instanceof TabGroupModelFilter)) {
String actualType = normalTabModelFilter == null
? "null"
: normalTabModelFilter.getClass().getName();
assert false
: "Please file bug, this is unexpected. Expected TabGroupModelFilter, but was "
+ actualType;
return;
}
}
OverviewModeBehavior overviewModeBehavior = OverviewModeBehavior overviewModeBehavior =
(OverviewModeBehavior) mActivity.getOverviewModeBehaviorSupplier().get(); (OverviewModeBehavior) mActivity.getOverviewModeBehaviorSupplier().get();
......
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