Release the AccessibilityBridge when destroying a legacy FlutterView (flutter/engine#20610)
This commit is contained in:
@@ -432,6 +432,7 @@ public class FlutterView extends SurfaceView
|
||||
if (!isAttached()) return;
|
||||
|
||||
getHolder().removeCallback(mSurfaceCallback);
|
||||
releaseAccessibilityNodeProvider();
|
||||
|
||||
mNativeView.destroy();
|
||||
mNativeView = null;
|
||||
@@ -749,9 +750,7 @@ public class FlutterView extends SurfaceView
|
||||
@Override
|
||||
protected void onDetachedFromWindow() {
|
||||
super.onDetachedFromWindow();
|
||||
|
||||
mAccessibilityNodeProvider.release();
|
||||
mAccessibilityNodeProvider = null;
|
||||
releaseAccessibilityNodeProvider();
|
||||
}
|
||||
|
||||
// TODO(mattcarroll): Confer with Ian as to why we need this method. Delete if possible, otherwise
|
||||
@@ -776,6 +775,13 @@ public class FlutterView extends SurfaceView
|
||||
}
|
||||
}
|
||||
|
||||
private void releaseAccessibilityNodeProvider() {
|
||||
if (mAccessibilityNodeProvider != null) {
|
||||
mAccessibilityNodeProvider.release();
|
||||
mAccessibilityNodeProvider = null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@TargetApi(Build.VERSION_CODES.N)
|
||||
@RequiresApi(Build.VERSION_CODES.N)
|
||||
|
||||
Reference in New Issue
Block a user