Fixes inset padding in android accessibility bridge#27083
Conversation
| boolean needsToApplyCutoutInsect = true; | ||
| if (Build.VERSION.SDK_INT >= 28) { | ||
| Context context = rootAccessibilityView.getContext(); | ||
| if (context instanceof Activity) { |
There was a problem hiding this comment.
I am not sure what is the best way to get the window attributes, if there is a better way, please let me know
There was a problem hiding this comment.
this works, but what about also handling ContextWrapper? Maybe, it could use https://github.com/flutter/engine/blob/40edba381e758e4abaaa4e59192748f12eb97895/shell/platform/android/io/flutter/view/FlutterView.java#L260
| * <p>This method will recursively traverse up the context chain if it is a {@link ContextWrapper} | ||
| * until it finds the first instance of the base context that is an {@link Activity}. | ||
| */ | ||
| private static Activity getActivity(Context context) { |
There was a problem hiding this comment.
It feels weird to put it here, but I don't want to expose a public api on embedding/engine/FlutterView.java.
There was a problem hiding this comment.
These packages are structured in a weird way. e.g. AccessibilityBridge should be in the same package as FlutterView. @jason-simmons do you have any context into why this is the case? Also, do you have any concerns if these are merged?
There was a problem hiding this comment.
There's a io/flutter/util folder. Do you mind if we create a ViewUtil class and move this static method there, and replace the one from FlutterView as well?
|
@blasten PTAL :) |
| final float[] identity = new float[16]; | ||
| Matrix.setIdentityM(identity, 0); | ||
| // in android devices API 23 and above, the system nav bar can be placed on the left side | ||
| // In android devices API 23 and above, the system nav bar can be placed on the left side |
There was a problem hiding this comment.
| // In android devices API 23 and above, the system nav bar can be placed on the left side | |
| // In Android devices API 23 and above, the system nav bar can be placed on the left side |
| rootObject.globalGeometryDirty = true; | ||
| rootObject.inverseTransformDirty = true; | ||
| boolean needsToApplyLeftCutoutInsect = true; | ||
| // In android devices API 28 and above, the window attribute, layoutInDisplayCutoutMode, |
There was a problem hiding this comment.
| // In android devices API 28 and above, the window attribute, layoutInDisplayCutoutMode, | |
| // In Android devices API 28 and above, the `layoutInDisplayCutoutMode` window attribute |
| rootObject.inverseTransformDirty = true; | ||
| boolean needsToApplyLeftCutoutInsect = true; | ||
| // In android devices API 28 and above, the window attribute, layoutInDisplayCutoutMode, | ||
| // can be set to allow overlapping content with the cutout area. Query the attribute |
There was a problem hiding this comment.
| // can be set to allow overlapping content with the cutout area. Query the attribute | |
| // can be set to allow overlapping content within the cutout area. Query the attribute |
| private boolean doesLayoutInDisplayCutoutModeRequireLeftInsect() { | ||
| Context context = rootAccessibilityView.getContext(); | ||
| Activity activity = getActivity(context); | ||
| if (activity != null) { |
There was a problem hiding this comment.
if activity is null then doesLayoutInDisplayCutoutModeRequireLeftInsect is true?
There was a problem hiding this comment.
I would expect something like this:
if (activity == null || activity.getWindow() == null) {
// The activity is null or not not visible, it does not matter whether to apply left insect
// or not.
return false;
}There was a problem hiding this comment.
In that case, it probably doesn't matter? I can set it to false
| } | ||
|
|
||
| /** | ||
| * Reads the layoutInDisplayCutoutMode value from the window attribute and returns whether a left |
There was a problem hiding this comment.
| * Reads the layoutInDisplayCutoutMode value from the window attribute and returns whether a left | |
| * Reads the {@code layoutInDisplayCutoutMode} value from the window attribute and returns whether a left |
|
This pull request is not suitable for automatic merging in its current state.
|
|
This pull request is not suitable for automatic merging in its current state.
|
|
This one needs a rebase as the failing tests have been disabled on ToT. |
|
Please amend the commit message to fix the typo before landing. |
fixes flutter/flutter#67835
Pre-launch Checklist
writing and running engine tests.
///).If you need help, consider asking for advice on the #hackers-new channel on Discord.