[Android] Initialize bottom controls synchronously to fix progress bar (#35464)

The deferred PostTask introduced to avoid ANR was causing the bottom
controls to be initialized after the progress bar, breaking it.
Revert to synchronous initialization.

Resolves: https://github.com/brave/brave-browser/issues/54458
This commit is contained in:
Serg
2026-04-13 15:49:47 -04:00
committed by GitHub
parent 8ced933b72
commit 5ba39ce79e
@@ -24,8 +24,6 @@ import org.chromium.base.supplier.NullableObservableSupplier;
import org.chromium.base.supplier.OneshotSupplier;
import org.chromium.base.supplier.SettableMonotonicObservableSupplier;
import org.chromium.base.supplier.SettableNonNullObservableSupplier;
import org.chromium.base.task.PostTask;
import org.chromium.base.task.TaskTraits;
import org.chromium.build.annotations.Nullable;
import org.chromium.cc.input.BrowserControlsState;
import org.chromium.chrome.R;
@@ -324,15 +322,7 @@ public class BraveToolbarManager extends ToolbarManager
return;
}
}
// Defer bottom controls inflation to avoid ANR from GPU contention
// during startup. All consumers null-check the coordinator supplier.
// The bottom toolbar starts with visibility="gone", so the one-frame
// delay is imperceptible to the user. Using makeCancelable ensures
// the task is auto-cancelled when mCallbackController.destroy() is
// called during Activity teardown, preventing use-after-destroy.
PostTask.postTask(
TaskTraits.UI_DEFAULT,
mCallbackController.makeCancelable(this::initBraveBottomControls));
initBraveBottomControls();
}
private void initBraveBottomControls() {