Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
import io.flutter.plugin.localization.LocalizationPlugin;
import io.flutter.plugin.mouse.MouseCursorPlugin;
import io.flutter.plugin.platform.PlatformViewsController;
import io.flutter.util.ViewUtils;
import io.flutter.view.AccessibilityBridge;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
Expand Down Expand Up @@ -455,7 +456,7 @@ protected WindowInfoRepositoryCallbackAdapterWrapper createWindowInfoRepo() {
try {
return new WindowInfoRepositoryCallbackAdapterWrapper(
new WindowInfoTrackerCallbackAdapter(
WindowInfoTracker.Companion.getOrCreate((Activity) getContext())));
WindowInfoTracker.Companion.getOrCreate(getContext())));
} catch (NoClassDefFoundError noClassDefFoundError) {
// Testing environment uses gn/javac, which does not work with aar files. This is why aar
// are converted to jar files, losing resources and other android-specific files.
Expand All @@ -476,9 +477,10 @@ protected WindowInfoRepositoryCallbackAdapterWrapper createWindowInfoRepo() {
protected void onAttachedToWindow() {
super.onAttachedToWindow();
this.windowInfoRepo = createWindowInfoRepo();
if (windowInfoRepo != null) {
Activity activity = ViewUtils.getActivity(getContext());
if (windowInfoRepo != null && activity != null) {
windowInfoRepo.addWindowLayoutInfoListener(
(Activity) getContext(), ContextCompat.getMainExecutor(getContext()), windowInfoListener);
activity, ContextCompat.getMainExecutor(getContext()), windowInfoListener);
}
}

Expand Down