This repository was archived by the owner on Feb 25, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6k
Handle SurfaceView in a VirtualDisplay #33599
Merged
Merged
Changes from 1 commit
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
0832efc
Handle SurfaceView and TextureView in a VirtualDisplay
e2b2b94
refactor
e2e2341
Fix licenses
a8675ec
Add logs
9d30502
comment
6981201
fix
b8e49a0
use info
583b597
remove nullable context
dde18d7
document code
7f87be7
fixes
5e924ab
fix test
7cb2919
fallback to VD if API level < 23
42adbc4
revert last pieces
cf3b220
add integration test
225f943
clean up
58e54df
add missing view_type
cffe771
revert
33877fa
fixes
e44e6cd
talkback issue
8f821f6
don't include TextureView since it breaks a11y in google maps
1cde9af
integration test (rotate activity + invalidate after frame)
7b4708a
feedback
f0d1029
dispose bug
110bdb5
fix comment line, so it fits in a line after formatting
5a2c81b
handle clamp
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
revert last pieces
- Loading branch information
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -105,7 +105,7 @@ public void show() { | |||||
|
|
||||||
| @Override | ||||||
| public void hide() { | ||||||
| if (inputTarget.type == InputTarget.Type.PLATFORM_VIEW) { | ||||||
| if (inputTarget.type == InputTarget.Type.HC_PLATFORM_VIEW) { | ||||||
| notifyViewExited(); | ||||||
| } else { | ||||||
| hideTextInput(mView); | ||||||
|
|
@@ -136,8 +136,8 @@ public void setClient( | |||||
| } | ||||||
|
|
||||||
| @Override | ||||||
| public void setPlatformViewClient(int platformViewId) { | ||||||
| setPlatformViewTextInputClient(platformViewId); | ||||||
| public void setPlatformViewClient(int platformViewId, boolean usesVirtualDisplay) { | ||||||
| setPlatformViewTextInputClient(platformViewId, usesVirtualDisplay); | ||||||
| } | ||||||
|
|
||||||
| @Override | ||||||
|
|
@@ -196,7 +196,7 @@ ImeSyncDeferringInsetsCallback getImeSyncCallback() { | |||||
| * display to another. | ||||||
| */ | ||||||
| public void lockPlatformViewInputConnection() { | ||||||
| if (inputTarget.type == InputTarget.Type.PLATFORM_VIEW) { | ||||||
| if (inputTarget.type == InputTarget.Type.VD_PLATFORM_VIEW) { | ||||||
| isInputConnectionLocked = true; | ||||||
| } | ||||||
| } | ||||||
|
|
@@ -207,7 +207,9 @@ public void lockPlatformViewInputConnection() { | |||||
| * <p>See also: @{link lockPlatformViewInputConnection}. | ||||||
| */ | ||||||
| public void unlockPlatformViewInputConnection() { | ||||||
| isInputConnectionLocked = false; | ||||||
| if (inputTarget.type == InputTarget.Type.VD_PLATFORM_VIEW) { | ||||||
| isInputConnectionLocked = false; | ||||||
| } | ||||||
| } | ||||||
|
|
||||||
| /** | ||||||
|
|
@@ -293,10 +295,21 @@ public InputConnection createInputConnection( | |||||
| return null; | ||||||
| } | ||||||
|
|
||||||
| if (inputTarget.type == InputTarget.Type.PLATFORM_VIEW) { | ||||||
| if (inputTarget.type == InputTarget.Type.HC_PLATFORM_VIEW) { | ||||||
| return null; | ||||||
| } | ||||||
|
|
||||||
| if (inputTarget.type == InputTarget.Type.VD_PLATFORM_VIEW) { | ||||||
| if (isInputConnectionLocked) { | ||||||
| return lastInputConnection; | ||||||
| } | ||||||
| lastInputConnection = | ||||||
| platformViewsController | ||||||
| .getPlatformViewById(inputTarget.id) | ||||||
| .onCreateInputConnection(outAttrs); | ||||||
| return lastInputConnection; | ||||||
| } | ||||||
|
|
||||||
| outAttrs.inputType = | ||||||
| inputTypeFromTextInputType( | ||||||
| configuration.inputType, | ||||||
|
|
@@ -351,7 +364,9 @@ public InputConnection getLastInputConnection() { | |||||
| * input connection. | ||||||
| */ | ||||||
| public void clearPlatformViewClient(int platformViewId) { | ||||||
| if (inputTarget.type == InputTarget.Type.PLATFORM_VIEW && inputTarget.id == platformViewId) { | ||||||
| if ((inputTarget.type == InputTarget.Type.VD_PLATFORM_VIEW | ||||||
| || inputTarget.type == InputTarget.Type.HC_PLATFORM_VIEW) | ||||||
| && inputTarget.id == platformViewId) { | ||||||
| inputTarget = new InputTarget(InputTarget.Type.NO_TARGET, 0); | ||||||
| notifyViewExited(); | ||||||
| mImm.hideSoftInputFromWindow(mView.getApplicationWindowToken(), 0); | ||||||
|
|
@@ -412,13 +427,25 @@ void setTextInputClient(int client, TextInputChannel.Configuration configuration | |||||
| // setTextInputClient will be followed by a call to setTextInputEditingState. | ||||||
| // Do a restartInput at that time. | ||||||
| mRestartInputPending = true; | ||||||
| unlockPlatformViewInputConnection(); | ||||||
| lastClientRect = null; | ||||||
| mEditable.addEditingStateListener(this); | ||||||
| } | ||||||
|
|
||||||
| private void setPlatformViewTextInputClient(int platformViewId) { | ||||||
| inputTarget = new InputTarget(InputTarget.Type.PLATFORM_VIEW, platformViewId); | ||||||
| lastInputConnection = null; | ||||||
| private void setPlatformViewTextInputClient(int platformViewId, boolean usesVirtualDisplay) { | ||||||
| if (usesVirtualDisplay) { | ||||||
| // We need to make sure that the Flutter view is focused so that no imm operations get short | ||||||
| // circuited. | ||||||
| // Not asking for focus here specifically manifested in a but on API 28 devices where the | ||||||
|
||||||
| // Not asking for focus here specifically manifested in a but on API 28 devices where the | |
| // Not asking for focus here specifically manifested in a bug on API 28 devices where the |
Outdated
Contributor
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: avoid abbreviations, VIRTUAL_DISPLAY_PLATFORM_VIEW, HYBRID_COMPOSITION_PLATFORM_VIEW
nit: please explain a bit more about what hybrid composition is - that's the one that uses ImageView right?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo: "bug"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done