use of android.view.View.AttachInfo in project android_frameworks_base by ParanoidAndroid.
the class AccessibilityInteractionController method applyAppScaleAndMagnificationSpecIfNeeded.
private void applyAppScaleAndMagnificationSpecIfNeeded(AccessibilityNodeInfo info, MagnificationSpec spec) {
if (info == null) {
return;
}
final float applicationScale = mViewRootImpl.mAttachInfo.mApplicationScale;
if (!shouldApplyAppScaleAndMagnificationSpec(applicationScale, spec)) {
return;
}
Rect boundsInParent = mTempRect;
Rect boundsInScreen = mTempRect1;
info.getBoundsInParent(boundsInParent);
info.getBoundsInScreen(boundsInScreen);
if (applicationScale != 1.0f) {
boundsInParent.scale(applicationScale);
boundsInScreen.scale(applicationScale);
}
if (spec != null) {
boundsInParent.scale(spec.scale);
// boundsInParent must not be offset.
boundsInScreen.scale(spec.scale);
boundsInScreen.offset((int) spec.offsetX, (int) spec.offsetY);
}
info.setBoundsInParent(boundsInParent);
info.setBoundsInScreen(boundsInScreen);
if (spec != null) {
AttachInfo attachInfo = mViewRootImpl.mAttachInfo;
if (attachInfo.mDisplay == null) {
return;
}
final float scale = attachInfo.mApplicationScale * spec.scale;
Rect visibleWinFrame = mTempRect1;
visibleWinFrame.left = (int) (attachInfo.mWindowLeft * scale + spec.offsetX);
visibleWinFrame.top = (int) (attachInfo.mWindowTop * scale + spec.offsetY);
visibleWinFrame.right = (int) (visibleWinFrame.left + mViewRootImpl.mWidth * scale);
visibleWinFrame.bottom = (int) (visibleWinFrame.top + mViewRootImpl.mHeight * scale);
attachInfo.mDisplay.getRealSize(mTempPoint);
final int displayWidth = mTempPoint.x;
final int displayHeight = mTempPoint.y;
Rect visibleDisplayFrame = mTempRect2;
visibleDisplayFrame.set(0, 0, displayWidth, displayHeight);
visibleWinFrame.intersect(visibleDisplayFrame);
if (!visibleWinFrame.intersects(boundsInScreen.left, boundsInScreen.top, boundsInScreen.right, boundsInScreen.bottom)) {
info.setVisibleToUser(false);
}
}
}
use of android.view.View.AttachInfo in project android_frameworks_base by ResurrectionRemix.
the class AttachInfo_Accessor method setAttachInfo.
public static void setAttachInfo(View view) {
Context context = view.getContext();
WindowManager wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
Display display = wm.getDefaultDisplay();
ViewRootImpl root = new ViewRootImpl(context, display);
AttachInfo info = new AttachInfo(new BridgeWindowSession(), new BridgeWindow(), display, root, new Handler(), null);
info.mHasWindowFocus = true;
info.mWindowVisibility = View.VISIBLE;
// this is so that we can display selections.
info.mInTouchMode = false;
info.mHardwareAccelerated = false;
view.dispatchAttachedToWindow(info, 0);
}
use of android.view.View.AttachInfo in project android_frameworks_base by ResurrectionRemix.
the class ViewRootImpl method getAccessibilityFocusedRect.
private boolean getAccessibilityFocusedRect(Rect bounds) {
final AccessibilityManager manager = AccessibilityManager.getInstance(mView.mContext);
if (!manager.isEnabled() || !manager.isTouchExplorationEnabled()) {
return false;
}
final View host = mAccessibilityFocusedHost;
if (host == null || host.mAttachInfo == null) {
return false;
}
final AccessibilityNodeProvider provider = host.getAccessibilityNodeProvider();
if (provider == null) {
host.getBoundsOnScreen(bounds, true);
} else if (mAccessibilityFocusedVirtualView != null) {
mAccessibilityFocusedVirtualView.getBoundsInScreen(bounds);
} else {
return false;
}
// Transform the rect into window-relative coordinates.
final AttachInfo attachInfo = mAttachInfo;
bounds.offset(0, attachInfo.mViewRootImpl.mScrollY);
bounds.offset(-attachInfo.mWindowLeft, -attachInfo.mWindowTop);
if (!bounds.intersect(0, 0, attachInfo.mViewRootImpl.mWidth, attachInfo.mViewRootImpl.mHeight)) {
// If no intersection, set bounds to empty.
bounds.setEmpty();
}
return !bounds.isEmpty();
}
use of android.view.View.AttachInfo in project android_frameworks_base by DirtyUnicorns.
the class AttachInfo_Accessor method setAttachInfo.
public static void setAttachInfo(View view) {
Context context = view.getContext();
WindowManager wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
Display display = wm.getDefaultDisplay();
ViewRootImpl root = new ViewRootImpl(context, display);
AttachInfo info = new AttachInfo(new BridgeWindowSession(), new BridgeWindow(), display, root, new Handler(), null);
info.mHasWindowFocus = true;
info.mWindowVisibility = View.VISIBLE;
// this is so that we can display selections.
info.mInTouchMode = false;
info.mHardwareAccelerated = false;
view.dispatchAttachedToWindow(info, 0);
}
use of android.view.View.AttachInfo in project android_frameworks_base by DirtyUnicorns.
the class AccessibilityInteractionController method applyAppScaleAndMagnificationSpecIfNeeded.
private void applyAppScaleAndMagnificationSpecIfNeeded(AccessibilityNodeInfo info, MagnificationSpec spec) {
if (info == null) {
return;
}
final float applicationScale = mViewRootImpl.mAttachInfo.mApplicationScale;
if (!shouldApplyAppScaleAndMagnificationSpec(applicationScale, spec)) {
return;
}
Rect boundsInParent = mTempRect;
Rect boundsInScreen = mTempRect1;
info.getBoundsInParent(boundsInParent);
info.getBoundsInScreen(boundsInScreen);
if (applicationScale != 1.0f) {
boundsInParent.scale(applicationScale);
boundsInScreen.scale(applicationScale);
}
if (spec != null) {
boundsInParent.scale(spec.scale);
// boundsInParent must not be offset.
boundsInScreen.scale(spec.scale);
boundsInScreen.offset((int) spec.offsetX, (int) spec.offsetY);
}
info.setBoundsInParent(boundsInParent);
info.setBoundsInScreen(boundsInScreen);
if (spec != null) {
AttachInfo attachInfo = mViewRootImpl.mAttachInfo;
if (attachInfo.mDisplay == null) {
return;
}
final float scale = attachInfo.mApplicationScale * spec.scale;
Rect visibleWinFrame = mTempRect1;
visibleWinFrame.left = (int) (attachInfo.mWindowLeft * scale + spec.offsetX);
visibleWinFrame.top = (int) (attachInfo.mWindowTop * scale + spec.offsetY);
visibleWinFrame.right = (int) (visibleWinFrame.left + mViewRootImpl.mWidth * scale);
visibleWinFrame.bottom = (int) (visibleWinFrame.top + mViewRootImpl.mHeight * scale);
attachInfo.mDisplay.getRealSize(mTempPoint);
final int displayWidth = mTempPoint.x;
final int displayHeight = mTempPoint.y;
Rect visibleDisplayFrame = mTempRect2;
visibleDisplayFrame.set(0, 0, displayWidth, displayHeight);
if (!visibleWinFrame.intersect(visibleDisplayFrame)) {
// If there's no intersection with display, set visibleWinFrame empty.
visibleDisplayFrame.setEmpty();
}
if (!visibleWinFrame.intersects(boundsInScreen.left, boundsInScreen.top, boundsInScreen.right, boundsInScreen.bottom)) {
info.setVisibleToUser(false);
}
}
}
Aggregations