use of android.graphics.Region in project android_frameworks_base by crdroidandroid.
the class AccessibilityInteractionController method findAccessibilityNodeInfosByViewIdUiThread.
private void findAccessibilityNodeInfosByViewIdUiThread(Message message) {
final int flags = message.arg1;
final int accessibilityViewId = message.arg2;
SomeArgs args = (SomeArgs) message.obj;
final int interactionId = args.argi1;
final IAccessibilityInteractionConnectionCallback callback = (IAccessibilityInteractionConnectionCallback) args.arg1;
final MagnificationSpec spec = (MagnificationSpec) args.arg2;
final String viewId = (String) args.arg3;
final Region interactiveRegion = (Region) args.arg4;
args.recycle();
final List<AccessibilityNodeInfo> infos = mTempAccessibilityNodeInfoList;
infos.clear();
try {
if (mViewRootImpl.mView == null || mViewRootImpl.mAttachInfo == null) {
return;
}
mViewRootImpl.mAttachInfo.mAccessibilityFetchFlags = flags;
View root = null;
if (accessibilityViewId != AccessibilityNodeInfo.UNDEFINED_ITEM_ID) {
root = findViewByAccessibilityId(accessibilityViewId);
} else {
root = mViewRootImpl.mView;
}
if (root != null) {
final int resolvedViewId = root.getContext().getResources().getIdentifier(viewId, null, null);
if (resolvedViewId <= 0) {
return;
}
if (mAddNodeInfosForViewId == null) {
mAddNodeInfosForViewId = new AddNodeInfosForViewId();
}
mAddNodeInfosForViewId.init(resolvedViewId, infos);
root.findViewByPredicate(mAddNodeInfosForViewId);
mAddNodeInfosForViewId.reset();
}
} finally {
try {
mViewRootImpl.mAttachInfo.mAccessibilityFetchFlags = 0;
applyAppScaleAndMagnificationSpecIfNeeded(infos, spec);
// system process and obtained from a pool when read from parcel.
if (spec != null && android.os.Process.myPid() != Binder.getCallingPid()) {
spec.recycle();
}
adjustIsVisibleToUserIfNeeded(infos, interactiveRegion);
callback.setFindAccessibilityNodeInfosResult(infos, interactionId);
} catch (RemoteException re) {
/* ignore - the other side will time out */
}
// the system process and instantiated when read from parcel.
if (interactiveRegion != null && android.os.Process.myPid() == Binder.getCallingPid()) {
interactiveRegion.recycle();
}
}
}
use of android.graphics.Region in project android_frameworks_base by crdroidandroid.
the class AccessibilityInteractionController method focusSearchUiThread.
private void focusSearchUiThread(Message message) {
final int flags = message.arg1;
final int accessibilityViewId = message.arg2;
SomeArgs args = (SomeArgs) message.obj;
final int direction = args.argi2;
final int interactionId = args.argi3;
final IAccessibilityInteractionConnectionCallback callback = (IAccessibilityInteractionConnectionCallback) args.arg1;
final MagnificationSpec spec = (MagnificationSpec) args.arg2;
final Region interactiveRegion = (Region) args.arg3;
args.recycle();
AccessibilityNodeInfo next = null;
try {
if (mViewRootImpl.mView == null || mViewRootImpl.mAttachInfo == null) {
return;
}
mViewRootImpl.mAttachInfo.mAccessibilityFetchFlags = flags;
View root = null;
if (accessibilityViewId != AccessibilityNodeInfo.UNDEFINED_ITEM_ID) {
root = findViewByAccessibilityId(accessibilityViewId);
} else {
root = mViewRootImpl.mView;
}
if (root != null && isShown(root)) {
View nextView = root.focusSearch(direction);
if (nextView != null) {
next = nextView.createAccessibilityNodeInfo();
}
}
} finally {
try {
mViewRootImpl.mAttachInfo.mAccessibilityFetchFlags = 0;
applyAppScaleAndMagnificationSpecIfNeeded(next, spec);
// system process and obtained from a pool when read from parcel.
if (spec != null && android.os.Process.myPid() != Binder.getCallingPid()) {
spec.recycle();
}
adjustIsVisibleToUserIfNeeded(next, interactiveRegion);
callback.setFindAccessibilityNodeInfoResult(next, interactionId);
} catch (RemoteException re) {
/* ignore - the other side will time out */
}
// the system process and instantiated when read from parcel.
if (interactiveRegion != null && android.os.Process.myPid() == Binder.getCallingPid()) {
interactiveRegion.recycle();
}
}
}
use of android.graphics.Region in project android_frameworks_base by crdroidandroid.
the class AccessibilityInteractionController method findFocusUiThread.
private void findFocusUiThread(Message message) {
final int flags = message.arg1;
final int focusType = message.arg2;
SomeArgs args = (SomeArgs) message.obj;
final int interactionId = args.argi1;
final int accessibilityViewId = args.argi2;
final int virtualDescendantId = args.argi3;
final IAccessibilityInteractionConnectionCallback callback = (IAccessibilityInteractionConnectionCallback) args.arg1;
final MagnificationSpec spec = (MagnificationSpec) args.arg2;
final Region interactiveRegion = (Region) args.arg3;
args.recycle();
AccessibilityNodeInfo focused = null;
try {
if (mViewRootImpl.mView == null || mViewRootImpl.mAttachInfo == null) {
return;
}
mViewRootImpl.mAttachInfo.mAccessibilityFetchFlags = flags;
View root = null;
if (accessibilityViewId != AccessibilityNodeInfo.UNDEFINED_ITEM_ID) {
root = findViewByAccessibilityId(accessibilityViewId);
} else {
root = mViewRootImpl.mView;
}
if (root != null && isShown(root)) {
switch(focusType) {
case AccessibilityNodeInfo.FOCUS_ACCESSIBILITY:
{
View host = mViewRootImpl.mAccessibilityFocusedHost;
// of the root from which to start the search, then the search failed.
if (host == null || !ViewRootImpl.isViewDescendantOf(host, root)) {
break;
}
// The focused view not shown, we failed.
if (!isShown(host)) {
break;
}
// If the host has a provider ask this provider to search for the
// focus instead fetching all provider nodes to do the search here.
AccessibilityNodeProvider provider = host.getAccessibilityNodeProvider();
if (provider != null) {
if (mViewRootImpl.mAccessibilityFocusedVirtualView != null) {
focused = AccessibilityNodeInfo.obtain(mViewRootImpl.mAccessibilityFocusedVirtualView);
}
} else if (virtualDescendantId == AccessibilityNodeInfo.UNDEFINED_ITEM_ID) {
focused = host.createAccessibilityNodeInfo();
}
}
break;
case AccessibilityNodeInfo.FOCUS_INPUT:
{
View target = root.findFocus();
if (target == null || !isShown(target)) {
break;
}
AccessibilityNodeProvider provider = target.getAccessibilityNodeProvider();
if (provider != null) {
focused = provider.findFocus(focusType);
}
if (focused == null) {
focused = target.createAccessibilityNodeInfo();
}
}
break;
default:
throw new IllegalArgumentException("Unknown focus type: " + focusType);
}
}
} finally {
try {
mViewRootImpl.mAttachInfo.mAccessibilityFetchFlags = 0;
applyAppScaleAndMagnificationSpecIfNeeded(focused, spec);
// system process and obtained from a pool when read from parcel.
if (spec != null && android.os.Process.myPid() != Binder.getCallingPid()) {
spec.recycle();
}
adjustIsVisibleToUserIfNeeded(focused, interactiveRegion);
callback.setFindAccessibilityNodeInfoResult(focused, interactionId);
} catch (RemoteException re) {
/* ignore - the other side will time out */
}
// the system process and instantiated when read from parcel.
if (interactiveRegion != null && android.os.Process.myPid() == Binder.getCallingPid()) {
interactiveRegion.recycle();
}
}
}
use of android.graphics.Region in project android_frameworks_base by crdroidandroid.
the class WindowState method getTouchableRegion.
void getTouchableRegion(Region outRegion) {
final Rect frame = mFrame;
switch(mTouchableInsets) {
default:
case TOUCHABLE_INSETS_FRAME:
outRegion.set(frame);
break;
case TOUCHABLE_INSETS_CONTENT:
applyInsets(outRegion, frame, mGivenContentInsets);
break;
case TOUCHABLE_INSETS_VISIBLE:
applyInsets(outRegion, frame, mGivenVisibleInsets);
break;
case TOUCHABLE_INSETS_REGION:
{
final Region givenTouchableRegion = mGivenTouchableRegion;
outRegion.set(givenTouchableRegion);
outRegion.translate(frame.left, frame.top);
break;
}
}
cropRegionToStackBoundsIfNeeded(outRegion);
}
use of android.graphics.Region in project android_frameworks_base by crdroidandroid.
the class WindowState method dump.
void dump(PrintWriter pw, String prefix, boolean dumpAll) {
final TaskStack stack = getStack();
pw.print(prefix);
pw.print("mDisplayId=");
pw.print(getDisplayId());
if (stack != null) {
pw.print(" stackId=");
pw.print(stack.mStackId);
}
if (mNotOnAppsDisplay) {
pw.print(" mNotOnAppsDisplay=");
pw.print(mNotOnAppsDisplay);
}
pw.print(" mSession=");
pw.print(mSession);
pw.print(" mClient=");
pw.println(mClient.asBinder());
pw.print(prefix);
pw.print("mOwnerUid=");
pw.print(mOwnerUid);
pw.print(" mShowToOwnerOnly=");
pw.print(mShowToOwnerOnly);
pw.print(" package=");
pw.print(mAttrs.packageName);
pw.print(" appop=");
pw.println(AppOpsManager.opToName(mAppOp));
pw.print(prefix);
pw.print("mAttrs=");
pw.println(mAttrs);
pw.print(prefix);
pw.print("Requested w=");
pw.print(mRequestedWidth);
pw.print(" h=");
pw.print(mRequestedHeight);
pw.print(" mLayoutSeq=");
pw.println(mLayoutSeq);
if (mRequestedWidth != mLastRequestedWidth || mRequestedHeight != mLastRequestedHeight) {
pw.print(prefix);
pw.print("LastRequested w=");
pw.print(mLastRequestedWidth);
pw.print(" h=");
pw.println(mLastRequestedHeight);
}
if (isChildWindow() || mLayoutAttached) {
pw.print(prefix);
pw.print("mAttachedWindow=");
pw.print(mAttachedWindow);
pw.print(" mLayoutAttached=");
pw.println(mLayoutAttached);
}
if (mIsImWindow || mIsWallpaper || mIsFloatingLayer) {
pw.print(prefix);
pw.print("mIsImWindow=");
pw.print(mIsImWindow);
pw.print(" mIsWallpaper=");
pw.print(mIsWallpaper);
pw.print(" mIsFloatingLayer=");
pw.print(mIsFloatingLayer);
pw.print(" mWallpaperVisible=");
pw.println(mWallpaperVisible);
}
if (dumpAll) {
pw.print(prefix);
pw.print("mBaseLayer=");
pw.print(mBaseLayer);
pw.print(" mSubLayer=");
pw.print(mSubLayer);
pw.print(" mAnimLayer=");
pw.print(mLayer);
pw.print("+");
pw.print((mTargetAppToken != null ? mTargetAppToken.mAppAnimator.animLayerAdjustment : (mAppToken != null ? mAppToken.mAppAnimator.animLayerAdjustment : 0)));
pw.print("=");
pw.print(mWinAnimator.mAnimLayer);
pw.print(" mLastLayer=");
pw.println(mWinAnimator.mLastLayer);
}
if (dumpAll) {
pw.print(prefix);
pw.print("mToken=");
pw.println(mToken);
pw.print(prefix);
pw.print("mRootToken=");
pw.println(mRootToken);
if (mAppToken != null) {
pw.print(prefix);
pw.print("mAppToken=");
pw.println(mAppToken);
pw.print(prefix);
pw.print(" isAnimatingWithSavedSurface()=");
pw.print(isAnimatingWithSavedSurface());
pw.print(" mAppDied=");
pw.println(mAppDied);
}
if (mTargetAppToken != null) {
pw.print(prefix);
pw.print("mTargetAppToken=");
pw.println(mTargetAppToken);
}
pw.print(prefix);
pw.print("mViewVisibility=0x");
pw.print(Integer.toHexString(mViewVisibility));
pw.print(" mHaveFrame=");
pw.print(mHaveFrame);
pw.print(" mObscured=");
pw.println(mObscured);
pw.print(prefix);
pw.print("mSeq=");
pw.print(mSeq);
pw.print(" mSystemUiVisibility=0x");
pw.println(Integer.toHexString(mSystemUiVisibility));
}
if (!mPolicyVisibility || !mPolicyVisibilityAfterAnim || !mAppOpVisibility || mAttachedHidden || mPermanentlyHidden) {
pw.print(prefix);
pw.print("mPolicyVisibility=");
pw.print(mPolicyVisibility);
pw.print(" mPolicyVisibilityAfterAnim=");
pw.print(mPolicyVisibilityAfterAnim);
pw.print(" mAppOpVisibility=");
pw.print(mAppOpVisibility);
pw.print(" mAttachedHidden=");
pw.println(mAttachedHidden);
pw.print(" mPermanentlyHidden=");
pw.println(mPermanentlyHidden);
}
if (!mRelayoutCalled || mLayoutNeeded) {
pw.print(prefix);
pw.print("mRelayoutCalled=");
pw.print(mRelayoutCalled);
pw.print(" mLayoutNeeded=");
pw.println(mLayoutNeeded);
}
if (mXOffset != 0 || mYOffset != 0) {
pw.print(prefix);
pw.print("Offsets x=");
pw.print(mXOffset);
pw.print(" y=");
pw.println(mYOffset);
}
if (dumpAll) {
pw.print(prefix);
pw.print("mGivenContentInsets=");
mGivenContentInsets.printShortString(pw);
pw.print(" mGivenVisibleInsets=");
mGivenVisibleInsets.printShortString(pw);
pw.println();
if (mTouchableInsets != 0 || mGivenInsetsPending) {
pw.print(prefix);
pw.print("mTouchableInsets=");
pw.print(mTouchableInsets);
pw.print(" mGivenInsetsPending=");
pw.println(mGivenInsetsPending);
Region region = new Region();
getTouchableRegion(region);
pw.print(prefix);
pw.print("touchable region=");
pw.println(region);
}
pw.print(prefix);
pw.print("mMergedConfiguration=");
pw.println(mMergedConfiguration);
}
pw.print(prefix);
pw.print("mHasSurface=");
pw.print(mHasSurface);
pw.print(" mShownPosition=");
mShownPosition.printShortString(pw);
pw.print(" isReadyForDisplay()=");
pw.print(isReadyForDisplay());
pw.print(" hasSavedSurface()=");
pw.print(hasSavedSurface());
pw.print(" mWindowRemovalAllowed=");
pw.println(mWindowRemovalAllowed);
if (dumpAll) {
pw.print(prefix);
pw.print("mFrame=");
mFrame.printShortString(pw);
pw.print(" last=");
mLastFrame.printShortString(pw);
pw.println();
}
if (mEnforceSizeCompat) {
pw.print(prefix);
pw.print("mCompatFrame=");
mCompatFrame.printShortString(pw);
pw.println();
}
if (dumpAll) {
pw.print(prefix);
pw.print("Frames: containing=");
mContainingFrame.printShortString(pw);
pw.print(" parent=");
mParentFrame.printShortString(pw);
pw.println();
pw.print(prefix);
pw.print(" display=");
mDisplayFrame.printShortString(pw);
pw.print(" overscan=");
mOverscanFrame.printShortString(pw);
pw.println();
pw.print(prefix);
pw.print(" content=");
mContentFrame.printShortString(pw);
pw.print(" visible=");
mVisibleFrame.printShortString(pw);
pw.println();
pw.print(prefix);
pw.print(" decor=");
mDecorFrame.printShortString(pw);
pw.println();
pw.print(prefix);
pw.print(" outset=");
mOutsetFrame.printShortString(pw);
pw.println();
pw.print(prefix);
pw.print("Cur insets: overscan=");
mOverscanInsets.printShortString(pw);
pw.print(" content=");
mContentInsets.printShortString(pw);
pw.print(" visible=");
mVisibleInsets.printShortString(pw);
pw.print(" stable=");
mStableInsets.printShortString(pw);
pw.print(" surface=");
mAttrs.surfaceInsets.printShortString(pw);
pw.print(" outsets=");
mOutsets.printShortString(pw);
pw.println();
pw.print(prefix);
pw.print("Lst insets: overscan=");
mLastOverscanInsets.printShortString(pw);
pw.print(" content=");
mLastContentInsets.printShortString(pw);
pw.print(" visible=");
mLastVisibleInsets.printShortString(pw);
pw.print(" stable=");
mLastStableInsets.printShortString(pw);
pw.print(" physical=");
mLastOutsets.printShortString(pw);
pw.print(" outset=");
mLastOutsets.printShortString(pw);
pw.println();
}
pw.print(prefix);
pw.print(mWinAnimator);
pw.println(":");
mWinAnimator.dump(pw, prefix + " ", dumpAll);
if (mAnimatingExit || mRemoveOnExit || mDestroying || mRemoved) {
pw.print(prefix);
pw.print("mAnimatingExit=");
pw.print(mAnimatingExit);
pw.print(" mRemoveOnExit=");
pw.print(mRemoveOnExit);
pw.print(" mDestroying=");
pw.print(mDestroying);
pw.print(" mRemoved=");
pw.println(mRemoved);
}
if (mOrientationChanging || mAppFreezing || mTurnOnScreen) {
pw.print(prefix);
pw.print("mOrientationChanging=");
pw.print(mOrientationChanging);
pw.print(" mAppFreezing=");
pw.print(mAppFreezing);
pw.print(" mTurnOnScreen=");
pw.println(mTurnOnScreen);
}
if (mLastFreezeDuration != 0) {
pw.print(prefix);
pw.print("mLastFreezeDuration=");
TimeUtils.formatDuration(mLastFreezeDuration, pw);
pw.println();
}
if (mHScale != 1 || mVScale != 1) {
pw.print(prefix);
pw.print("mHScale=");
pw.print(mHScale);
pw.print(" mVScale=");
pw.println(mVScale);
}
if (mWallpaperX != -1 || mWallpaperY != -1) {
pw.print(prefix);
pw.print("mWallpaperX=");
pw.print(mWallpaperX);
pw.print(" mWallpaperY=");
pw.println(mWallpaperY);
}
if (mWallpaperXStep != -1 || mWallpaperYStep != -1) {
pw.print(prefix);
pw.print("mWallpaperXStep=");
pw.print(mWallpaperXStep);
pw.print(" mWallpaperYStep=");
pw.println(mWallpaperYStep);
}
if (mWallpaperDisplayOffsetX != Integer.MIN_VALUE || mWallpaperDisplayOffsetY != Integer.MIN_VALUE) {
pw.print(prefix);
pw.print("mWallpaperDisplayOffsetX=");
pw.print(mWallpaperDisplayOffsetX);
pw.print(" mWallpaperDisplayOffsetY=");
pw.println(mWallpaperDisplayOffsetY);
}
if (mDrawLock != null) {
pw.print(prefix);
pw.println("mDrawLock=" + mDrawLock);
}
if (isDragResizing()) {
pw.print(prefix);
pw.println("isDragResizing=" + isDragResizing());
}
if (computeDragResizing()) {
pw.print(prefix);
pw.println("computeDragResizing=" + computeDragResizing());
}
}
Aggregations