Loading core/java/android/view/AccessibilityInteractionController.java +28 −0 Original line number Diff line number Diff line Loading @@ -830,6 +830,32 @@ public final class AccessibilityInteractionController { return false; } private void adjustBoundsInScreenIfNeeded(List<AccessibilityNodeInfo> infos) { if (infos == null || shouldBypassAdjustBoundsInScreen()) { return; } final int infoCount = infos.size(); for (int i = 0; i < infoCount; i++) { final AccessibilityNodeInfo info = infos.get(i); adjustBoundsInScreenIfNeeded(info); } } private void adjustBoundsInScreenIfNeeded(AccessibilityNodeInfo info) { if (info == null || shouldBypassAdjustBoundsInScreen()) { return; } final Rect boundsInScreen = mTempRect; info.getBoundsInScreen(boundsInScreen); boundsInScreen.offset(mViewRootImpl.mAttachInfo.mLocationInParentDisplay.x, mViewRootImpl.mAttachInfo.mLocationInParentDisplay.y); info.setBoundsInScreen(boundsInScreen); } private boolean shouldBypassAdjustBoundsInScreen() { return mViewRootImpl.mAttachInfo.mLocationInParentDisplay.equals(0, 0); } private void applyAppScaleAndMagnificationSpecIfNeeded(AccessibilityNodeInfo info, MagnificationSpec spec) { if (info == null) { Loading Loading @@ -921,6 +947,7 @@ public final class AccessibilityInteractionController { MagnificationSpec spec, Region interactiveRegion) { try { mViewRootImpl.mAttachInfo.mAccessibilityFetchFlags = 0; adjustBoundsInScreenIfNeeded(infos); applyAppScaleAndMagnificationSpecIfNeeded(infos, spec); adjustIsVisibleToUserIfNeeded(infos, interactiveRegion); callback.setFindAccessibilityNodeInfosResult(infos, interactionId); Loading @@ -939,6 +966,7 @@ public final class AccessibilityInteractionController { MagnificationSpec spec, Region interactiveRegion) { try { mViewRootImpl.mAttachInfo.mAccessibilityFetchFlags = 0; adjustBoundsInScreenIfNeeded(info); applyAppScaleAndMagnificationSpecIfNeeded(info, spec); adjustIsVisibleToUserIfNeeded(info, interactiveRegion); callback.setFindAccessibilityNodeInfoResult(info, interactionId); Loading core/java/android/view/IWindow.aidl +7 −0 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ package android.view; import android.graphics.Point; import android.graphics.Rect; import android.os.Bundle; import android.os.ParcelFileDescriptor; Loading Loading @@ -56,6 +57,12 @@ oneway interface IWindow { boolean forceLayout, boolean alwaysConsumeSystemBars, int displayId, in DisplayCutout.ParcelableWrapper displayCutout); /** * Called when the window location in parent display has changed. The offset will only be a * nonzero value if the window is on an embedded display that is re-parented to another window. */ void locationInParentDisplayChanged(in Point offset); /** * Called when the window insets configuration has changed. */ Loading core/java/android/view/View.java +6 −0 Original line number Diff line number Diff line Loading @@ -28551,6 +28551,12 @@ public class View implements Drawable.Callback, KeyEvent.Callback, */ boolean mHandlingPointerEvent; /** * The offset of this view's window when it's on an embedded display that is re-parented * to another window. */ final Point mLocationInParentDisplay = new Point(); /** * Global to the view hierarchy used as a temporary for dealing with * x/y points in the transparent region computations. core/java/android/view/ViewRootImpl.java +32 −0 Original line number Diff line number Diff line Loading @@ -3982,6 +3982,13 @@ public final class ViewRootImpl implements ViewParent, } } void updateLocationInParentDisplay(int x, int y) { if (mAttachInfo != null && !mAttachInfo.mLocationInParentDisplay.equals(x, y)) { mAttachInfo.mLocationInParentDisplay.set(x, y); } } /** * Set the root-level system gesture exclusion rects. These are added to those provided by * the root's view hierarchy. Loading Loading @@ -4486,6 +4493,7 @@ public final class ViewRootImpl implements ViewParent, private static final int MSG_INSETS_CHANGED = 30; private static final int MSG_INSETS_CONTROL_CHANGED = 31; private static final int MSG_SYSTEM_GESTURE_EXCLUSION_CHANGED = 32; private static final int MSG_LOCATION_IN_PARENT_DISPLAY_CHANGED = 33; final class ViewRootHandler extends Handler { @Override Loading Loading @@ -4547,6 +4555,8 @@ public final class ViewRootImpl implements ViewParent, return "MSG_INSETS_CONTROL_CHANGED"; case MSG_SYSTEM_GESTURE_EXCLUSION_CHANGED: return "MSG_SYSTEM_GESTURE_EXCLUSION_CHANGED"; case MSG_LOCATION_IN_PARENT_DISPLAY_CHANGED: return "MSG_LOCATION_IN_PARENT_DISPLAY_CHANGED"; } return super.getMessageName(message); } Loading Loading @@ -4780,6 +4790,9 @@ public final class ViewRootImpl implements ViewParent, case MSG_SYSTEM_GESTURE_EXCLUSION_CHANGED: { systemGestureExclusionChanged(); } break; case MSG_LOCATION_IN_PARENT_DISPLAY_CHANGED: { updateLocationInParentDisplay(msg.arg1, msg.arg2); } break; } } } Loading Loading @@ -7986,6 +7999,17 @@ public final class ViewRootImpl implements ViewParent, mHandler.sendMessage(msg); } /** * Dispatch the offset changed. * * @param offset the offset of this view in the parent window. */ public void dispatchLocationInParentDisplayChanged(Point offset) { Message msg = mHandler.obtainMessage(MSG_LOCATION_IN_PARENT_DISPLAY_CHANGED, offset.x, offset.y); mHandler.sendMessage(msg); } public void windowFocusChanged(boolean hasFocus, boolean inTouchMode) { synchronized (this) { mWindowFocusChanged = true; Loading Loading @@ -8512,6 +8536,14 @@ public final class ViewRootImpl implements ViewParent, } } @Override public void locationInParentDisplayChanged(Point offset) { final ViewRootImpl viewAncestor = mViewAncestor.get(); if (viewAncestor != null) { viewAncestor.dispatchLocationInParentDisplayChanged(offset); } } @Override public void insetsChanged(InsetsState insetsState) { final ViewRootImpl viewAncestor = mViewAncestor.get(); Loading core/java/com/android/internal/view/BaseIWindow.java +5 −0 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ package com.android.internal.view; import android.graphics.Point; import android.graphics.Rect; import android.hardware.input.InputManager; import android.os.Bundle; Loading Loading @@ -54,6 +55,10 @@ public class BaseIWindow extends IWindow.Stub { } } @Override public void locationInParentDisplayChanged(Point offset) { } @Override public void insetsChanged(InsetsState insetsState) { } Loading Loading
core/java/android/view/AccessibilityInteractionController.java +28 −0 Original line number Diff line number Diff line Loading @@ -830,6 +830,32 @@ public final class AccessibilityInteractionController { return false; } private void adjustBoundsInScreenIfNeeded(List<AccessibilityNodeInfo> infos) { if (infos == null || shouldBypassAdjustBoundsInScreen()) { return; } final int infoCount = infos.size(); for (int i = 0; i < infoCount; i++) { final AccessibilityNodeInfo info = infos.get(i); adjustBoundsInScreenIfNeeded(info); } } private void adjustBoundsInScreenIfNeeded(AccessibilityNodeInfo info) { if (info == null || shouldBypassAdjustBoundsInScreen()) { return; } final Rect boundsInScreen = mTempRect; info.getBoundsInScreen(boundsInScreen); boundsInScreen.offset(mViewRootImpl.mAttachInfo.mLocationInParentDisplay.x, mViewRootImpl.mAttachInfo.mLocationInParentDisplay.y); info.setBoundsInScreen(boundsInScreen); } private boolean shouldBypassAdjustBoundsInScreen() { return mViewRootImpl.mAttachInfo.mLocationInParentDisplay.equals(0, 0); } private void applyAppScaleAndMagnificationSpecIfNeeded(AccessibilityNodeInfo info, MagnificationSpec spec) { if (info == null) { Loading Loading @@ -921,6 +947,7 @@ public final class AccessibilityInteractionController { MagnificationSpec spec, Region interactiveRegion) { try { mViewRootImpl.mAttachInfo.mAccessibilityFetchFlags = 0; adjustBoundsInScreenIfNeeded(infos); applyAppScaleAndMagnificationSpecIfNeeded(infos, spec); adjustIsVisibleToUserIfNeeded(infos, interactiveRegion); callback.setFindAccessibilityNodeInfosResult(infos, interactionId); Loading @@ -939,6 +966,7 @@ public final class AccessibilityInteractionController { MagnificationSpec spec, Region interactiveRegion) { try { mViewRootImpl.mAttachInfo.mAccessibilityFetchFlags = 0; adjustBoundsInScreenIfNeeded(info); applyAppScaleAndMagnificationSpecIfNeeded(info, spec); adjustIsVisibleToUserIfNeeded(info, interactiveRegion); callback.setFindAccessibilityNodeInfoResult(info, interactionId); Loading
core/java/android/view/IWindow.aidl +7 −0 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ package android.view; import android.graphics.Point; import android.graphics.Rect; import android.os.Bundle; import android.os.ParcelFileDescriptor; Loading Loading @@ -56,6 +57,12 @@ oneway interface IWindow { boolean forceLayout, boolean alwaysConsumeSystemBars, int displayId, in DisplayCutout.ParcelableWrapper displayCutout); /** * Called when the window location in parent display has changed. The offset will only be a * nonzero value if the window is on an embedded display that is re-parented to another window. */ void locationInParentDisplayChanged(in Point offset); /** * Called when the window insets configuration has changed. */ Loading
core/java/android/view/View.java +6 −0 Original line number Diff line number Diff line Loading @@ -28551,6 +28551,12 @@ public class View implements Drawable.Callback, KeyEvent.Callback, */ boolean mHandlingPointerEvent; /** * The offset of this view's window when it's on an embedded display that is re-parented * to another window. */ final Point mLocationInParentDisplay = new Point(); /** * Global to the view hierarchy used as a temporary for dealing with * x/y points in the transparent region computations.
core/java/android/view/ViewRootImpl.java +32 −0 Original line number Diff line number Diff line Loading @@ -3982,6 +3982,13 @@ public final class ViewRootImpl implements ViewParent, } } void updateLocationInParentDisplay(int x, int y) { if (mAttachInfo != null && !mAttachInfo.mLocationInParentDisplay.equals(x, y)) { mAttachInfo.mLocationInParentDisplay.set(x, y); } } /** * Set the root-level system gesture exclusion rects. These are added to those provided by * the root's view hierarchy. Loading Loading @@ -4486,6 +4493,7 @@ public final class ViewRootImpl implements ViewParent, private static final int MSG_INSETS_CHANGED = 30; private static final int MSG_INSETS_CONTROL_CHANGED = 31; private static final int MSG_SYSTEM_GESTURE_EXCLUSION_CHANGED = 32; private static final int MSG_LOCATION_IN_PARENT_DISPLAY_CHANGED = 33; final class ViewRootHandler extends Handler { @Override Loading Loading @@ -4547,6 +4555,8 @@ public final class ViewRootImpl implements ViewParent, return "MSG_INSETS_CONTROL_CHANGED"; case MSG_SYSTEM_GESTURE_EXCLUSION_CHANGED: return "MSG_SYSTEM_GESTURE_EXCLUSION_CHANGED"; case MSG_LOCATION_IN_PARENT_DISPLAY_CHANGED: return "MSG_LOCATION_IN_PARENT_DISPLAY_CHANGED"; } return super.getMessageName(message); } Loading Loading @@ -4780,6 +4790,9 @@ public final class ViewRootImpl implements ViewParent, case MSG_SYSTEM_GESTURE_EXCLUSION_CHANGED: { systemGestureExclusionChanged(); } break; case MSG_LOCATION_IN_PARENT_DISPLAY_CHANGED: { updateLocationInParentDisplay(msg.arg1, msg.arg2); } break; } } } Loading Loading @@ -7986,6 +7999,17 @@ public final class ViewRootImpl implements ViewParent, mHandler.sendMessage(msg); } /** * Dispatch the offset changed. * * @param offset the offset of this view in the parent window. */ public void dispatchLocationInParentDisplayChanged(Point offset) { Message msg = mHandler.obtainMessage(MSG_LOCATION_IN_PARENT_DISPLAY_CHANGED, offset.x, offset.y); mHandler.sendMessage(msg); } public void windowFocusChanged(boolean hasFocus, boolean inTouchMode) { synchronized (this) { mWindowFocusChanged = true; Loading Loading @@ -8512,6 +8536,14 @@ public final class ViewRootImpl implements ViewParent, } } @Override public void locationInParentDisplayChanged(Point offset) { final ViewRootImpl viewAncestor = mViewAncestor.get(); if (viewAncestor != null) { viewAncestor.dispatchLocationInParentDisplayChanged(offset); } } @Override public void insetsChanged(InsetsState insetsState) { final ViewRootImpl viewAncestor = mViewAncestor.get(); Loading
core/java/com/android/internal/view/BaseIWindow.java +5 −0 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ package com.android.internal.view; import android.graphics.Point; import android.graphics.Rect; import android.hardware.input.InputManager; import android.os.Bundle; Loading Loading @@ -54,6 +55,10 @@ public class BaseIWindow extends IWindow.Stub { } } @Override public void locationInParentDisplayChanged(Point offset) { } @Override public void insetsChanged(InsetsState insetsState) { } Loading