Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
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
11 changes: 8 additions & 3 deletions shell/platform/android/io/flutter/view/FlutterNativeView.java
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,8 @@ private void handlePlatformMessageResponse(int replyId, byte[] reply) {

// Called by native to update the semantics/accessibility tree.
private void updateSemantics(ByteBuffer buffer, String[] strings) {
if (mFlutterView == null) return;
if (mFlutterView == null)
return;
mFlutterView.updateSemantics(buffer, strings);
}

Expand All @@ -218,13 +219,17 @@ private void updateCustomAccessibilityActions(ByteBuffer buffer, String[] string

// Called by native to notify first Flutter frame rendered.
private void onFirstFrame() {
if (mFlutterView == null) return;
if (mFlutterView == null)
return;
mFlutterView.onFirstFrame();
}

// Called by native to notify when the engine is restarted (cold reload).
// Called by native to notify when the engine is restarted (hot restart).
@SuppressWarnings("unused")
private void onPreEngineRestart() {
if (mFlutterView != null) {
mFlutterView.resetAccessibilityTree();
}
if (mPluginRegistry == null)
return;
mPluginRegistry.onPreEngineRestart();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,11 +129,12 @@ class AccessibilityBridge final {

fml::WeakPtr<AccessibilityBridge> GetWeakPtr();

void clearState();

private:
SemanticsObject* GetOrCreateObject(int32_t id, blink::SemanticsNodeUpdates& updates);
void VisitObjectsRecursivelyAndRemove(SemanticsObject* object,
NSMutableArray<NSNumber*>* doomed_uids);
void ReleaseObjects(std::unordered_map<int, SemanticsObject*>& objects);
void HandleEvent(NSDictionary<NSString*, id>* annotatedEvent);

UIView* view_;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -687,4 +687,10 @@ - (BOOL)accessibilityScroll:(UIAccessibilityScrollDirection)direction {
return weak_factory_.GetWeakPtr();
}

void AccessibilityBridge::clearState() {
[objects_ removeAllObjects];
previous_route_id_ = 0;
previous_routes_.clear();
}

} // namespace shell
3 changes: 3 additions & 0 deletions shell/platform/darwin/ios/platform_view_ios.mm
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,9 @@
}

void PlatformViewIOS::OnPreEngineRestart() const {
if (accessibility_bridge_) {
accessibility_bridge_->clearState();
}
if (!owner_controller_) {
return;
}
Expand Down